That line is appending an extraneous apostrophe to the end of the string. Why you feel the need to cancatenate an empty string to the end of those lines is beyobd me. This should be shorter, easier to read, more efficient and produce the same result: strWhere = strWhere & " AND Issues.ID = " & Me.TicketNumber
I don't relate to that error message, perhaps it's because the filter has invalid syntax. -- Marsh MVP [MS Access]
Kevin76 wrote:
[Quoted Text] >I have a search form that when searched opens a subform in the bottom with >the results of the search. I have many parameters to search by in the event >procedure of the on click function of the actual search button. In the below >code all the parameter searches work except the "If Assigned To" parameter of > > "Issues.[Company] = " & Me.AssignedTo & "'" > >I get the run time error 2448 You can not assign a value to this object. >When I debug it highlights the second to bottom line of code in yellow > Me.Browse_All_Issues1.Form.Filter = strWhere > >Please review the below code and let me know what I am missing. > >Private Sub Search_Click() > Const cInvalidDateError As String = "You have entered an invalid date." > Dim strWhere As String > Dim strError As String > > strWhere = "1=1" > > ' If Assigned To > If Not IsNull(Me.AssignedTo) Then > 'Create Predicate > strWhere = strWhere & " AND " & "Issues.[Company] = " & >Me.AssignedTo & "'" > End If
[snip the ones that work]
|