Combo Box and Run-time error

G

Guest

I'm working with an Access project and I'm trying to have a combo box that
will allow you to go to a record by selecting it from the box. I keep getting
this error:

Run-time error '438':
Object doesn't support this property or method

I have an event procedure running after update on the combo box.
This is the procedure:

Private Sub Combo31_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[Customer Code] = '" & Me![Combo31] & "'"
Me.Bookmark = rs.Bookmark
End Sub

When I debug it goes to the "rs.FindFirst..." line but I don't know enough
about this to figure out what to do next.
Any help is appreciated.
Thanks,
Rob
 
T

tina

check your CustomerCode field, is it a Text or Number data type? if Number,
then the syntax would be

"[Customer Code] = " & Me![Combo31]

you could also try the following instead of your current code, as

Private Sub Combo31_AfterUpdate()

Me.Recordset.FindFirst "[Customer Code] = '" & Me![Combo31] & "'"
If Me.Recordset.NoMatch Then
Me!Combo31 = Null
MsgBox "Record not found."
End If

End Sub

hth
 
G

Guest

That is not the problems. It is this
Set rs = Me.Recordset.Clone
Should be (no period before Clone)
Set rs = Me.RecordsetClone
tina said:
check your CustomerCode field, is it a Text or Number data type? if Number,
then the syntax would be

"[Customer Code] = " & Me![Combo31]

you could also try the following instead of your current code, as

Private Sub Combo31_AfterUpdate()

Me.Recordset.FindFirst "[Customer Code] = '" & Me![Combo31] & "'"
If Me.Recordset.NoMatch Then
Me!Combo31 = Null
MsgBox "Record not found."
End If

End Sub

hth


Rob said:
I'm working with an Access project and I'm trying to have a combo box that
will allow you to go to a record by selecting it from the box. I keep getting
this error:

Run-time error '438':
Object doesn't support this property or method

I have an event procedure running after update on the combo box.
This is the procedure:

Private Sub Combo31_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[Customer Code] = '" & Me![Combo31] & "'"
Me.Bookmark = rs.Bookmark
End Sub

When I debug it goes to the "rs.FindFirst..." line but I don't know enough
about this to figure out what to do next.
Any help is appreciated.
Thanks,
Rob
 

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