invalid procedure call or argument on searching form

  • Thread starter richard.williamson1
  • 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
 
G

Graham R Seach

Richard,

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

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

richard.williamson1

No luck I'm afraid :(
The debug starts at the Private Sub Combo27_Change() line and never
gets any further.

Any ideas much appreciated.
 
G

Guest

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.
 
G

Graham R Seach

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top