invalid procedure call or argument on searching form

  • Thread starter Thread starter richard.williamson1
  • Start date Start date
R

richard.williamson1

I have a form with subform which works fine. I then modified the form
by adding an unbound combo box. The following code was added to make
the form display what was selected in the combo box:

Private Sub Combo27_Change()
'find matching records
Dim rs As Object

Set rs = Me.Recordset.Clone
rs.findfirst "Resource_ID like '*" & Me![Combo27] & "*'"
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
End Sub

However, when I make a selection in the combo box, I get the "Invalid
procedure call or argument" error. the debugger goes to the Private sub
line. I've tried recreating the form, but I gat the same error.

TIA
 
Richard,

If Not rs.NoMatch Then Me.Bookmark = rs.Bookmark

Regards,
Graham R Seach
Microsoft Access MVP
Canberra, Australia
 
No luck I'm afraid :(
The debug starts at the Private Sub Combo27_Change() line and never
gets any further.

Any ideas much appreciated.
 
The Change event it the wrong place. Use the After Update event. The Change
event fires after every keystroke because each new character or even a
backspace is a change.
 
Richard,

Sorry. I didn't notice you were using the Change event. Some controls offer
a Text property when they have the focus. This is available during the
Change event. The Value property hasn't been update during that event.

rs.findfirst "Resource_ID like '*" & Me!Combo27.Text & "*'"
If Not rs.NoMatch Then Me.Bookmark = rs.Bookmark

Regards,
Graham R Seach
Microsoft Access MVP
Canberra, Australia
 
Back
Top