Combo Box giving run time error

joe31709

Registered User.
Local time
Today, 04:31
Joined
May 12, 2003
Messages
54
Here is the deal. I used to have this form and table as a separte database and I consolidated it into a another database. Now when I open up the form and us the combo box I get a run time error 3021 saying no current record found.

Here is the script on the combo box.
Private Sub Combo36_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[NSN] = '" & Me![Combo36] & "'"
Me.Bookmark = rs.Bookmark
End Sub

Where could I have gone wrong.

Thank you,

Joe
 
New error message now


Compile error:
Method or data member not found

The first line is highlighted also, if that helps


Private Sub Combo36_AfterUpdate()
' Find the record that matches the control.
Dim rs As Recordset

Set rs = Me.Recordset.Clone
rs.FindFirst "[NSN] = '" & Me![Combo36] & "'"
Me.Bookmark = rs.Bookmark
End Sub
 
Make sure you have a reference set for 'Microsoft DAO 3.6 Object Library'.
Open a form in design view, goto View >> Code..... Tools >> references and select it from the list.

IMO
 
I would go back to Dim rs as Object.

It sounds as if the findfirst is not finding a match, you could try this to test it

Set rs = Me.Recordset.Clone
rs.FindFirst "[NSN] = '" & Me![Combo36] & "'"
If Not rs.NoMatch Then
Me.Bookmark = rs.Bookmark
Else
Msgbox "No Match Found"
End If
 
It is saying No Match found now.

So where do i go from here?

Thank you,

Joe
 
Is the combo bound to the correct field to match the field you are searching on?
 
Ty the code like this, just my suggestion:
Code:
Private Sub Combo36_AfterUpdate()
' Find the record that matches the control.
Dim rs As DAO.Recordset

Set rs = Me.RecordsetClone
rs.FindFirst "[NSN] = '" & Me![Combo36] & "'"
Me.Bookmark = rs.Bookmark
End Sub
 
I feel like an idiot , but thank you for ya'lls help.


Here is what the problem was, I had the form on a switch board in Add mode and it needed to be in edit mode.

Cause I guess in Add mode it would not search the table for the info.

Thank you

Joe
 

Users who are viewing this thread

Back
Top Bottom