I keep running into Type Mismatch error 13 (is this really a bug in the program?) when I try to use the standard combobox code to find a record based on the selection in the combobox but add in a line to turn off any pre-existing filters. The code is:
Dim rs As Object
Me.FilterOn = False
Set rs = Me.Recordset.Clone
rs.FindFirst "[PartnerID] = " & Str(Nz(Me![cmbSearchbyPartnerName], 5))
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
After getting the Type Mismatch error message, the debugger highlights the rs.FindFirst line.
I have tried Dim rs As DAO.Recordset with the DAO 3.6 library checked above the ADO library in References, but that doesn?t fix it.
If I remove the FilterOn = False line, the combobox works fine. Problem is, the user can search for a record in this form a number of different ways that result in filtering, or the form might be opened from another form which filters the records based on the record selected in the calling form, so I need to be able to switch off any filters whenever a new search is performed.
I wonder if it's somehow because of the Str function? Though if it is, why would it work when the FilterOn = False line is removed?
The strangest thing is, I kept getting this error msg a few days ago and I worked and worked on the module and at the end of the day yesterday this code and all the other search code worked perfectly, no hitches. When I went back today to test it out again, it was right back to square one as if yesterday was all in my imagination??? It's not as though I changed anything in my sleep!!! lastout (the game's not over till it's over)
Dim rs As Object
Me.FilterOn = False
Set rs = Me.Recordset.Clone
rs.FindFirst "[PartnerID] = " & Str(Nz(Me![cmbSearchbyPartnerName], 5))
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
After getting the Type Mismatch error message, the debugger highlights the rs.FindFirst line.
I have tried Dim rs As DAO.Recordset with the DAO 3.6 library checked above the ADO library in References, but that doesn?t fix it.
If I remove the FilterOn = False line, the combobox works fine. Problem is, the user can search for a record in this form a number of different ways that result in filtering, or the form might be opened from another form which filters the records based on the record selected in the calling form, so I need to be able to switch off any filters whenever a new search is performed.
I wonder if it's somehow because of the Str function? Though if it is, why would it work when the FilterOn = False line is removed?
The strangest thing is, I kept getting this error msg a few days ago and I worked and worked on the module and at the end of the day yesterday this code and all the other search code worked perfectly, no hitches. When I went back today to test it out again, it was right back to square one as if yesterday was all in my imagination??? It's not as though I changed anything in my sleep!!! lastout (the game's not over till it's over)