I have a simple form for selecting a record to display based on entered criteria.
When I try to assign a value to the filter property, it gives me error 2448 "can't assign a value to this object". The value I am trying to assign is a string, and I can't see what I am doing wrong. Perhaps one of you can.
The form is based on a query:
SELECT vendor.VENDOR, tblprmain.pr_no, tblprmain.SUMMARY,vendor.VEND_NO
FROM tblprmain INNER JOIN vendor ON tblprmain.vendor_number = vendor.VEND_NO
ORDER BY vendor.VENDOR, tblprmain.pr_no;
The VBA code is on the button that starts the search. Here is the code:
Private Sub cmdSearch_Click()
Dim strwhere As String
Dim lnglen As Long
On Error GoTo cmdSearch_Click_Error
If Not IsNull(Me.vendortoselect) Then
strwhere = strwhere & [vendortoselect] & " and "
' check if there is anything in the select string, and strip off
' the trailing " and "
lnglen = Len(strwhere) - 5
If lnglen <= 0 Then
MsgBox "nothing to select"
strwhere = Left$(strwhere, lnglen)
Me.Filter = strwhere
Me.FilterOn = True
On Error GoTo 0