Finding a Record

sphere_monk

Registered User.
Local time
Yesterday, 19:44
Joined
Nov 18, 2002
Messages
62
I have the following code looking for a record:

Private Sub cboWOID_AfterUpdate()
MsgBox ("Running cboWOID_AfterUpdate")
Dim strCriteria As String
Dim rst As ADODB.Recordset
Set rst = Me.RecordsetClone
strCriteria = "WOID = " & cboWOID
rst.Find strCriteria
Me.Bookmark = rst.Bookmark
End Sub

My problem is that when the code runs, I get a Run-time error 13 - "Type mismatch" on the "Set rst = Me.RecordesetClone"

Could someone please help? I'm running Access 2002.
 
There is no Recordsetclone property in ADO. You have to use the Clone method instead:

Dim rst As Object
Set rst = Me.Recordset.Clone
 
Thank you. That enabled me to get by that message.

However, now I am receiving.....

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

...on the rst.Find strCriteria line of code. Is there a different search method I should be using?

Here is the code.....

Private Sub cboWOID_AfterUpdate()

Dim WOtoFind As String
Dim strCriteria As String
Dim rst As Object

Set rst = Me.Recordset.Clone
WOtoFind = Left((cboWOID & " "), 7)
strCriteria = "WOID = " & WOtoFind

rst.Find strCriteria
Me.Bookmark = rst.Bookmark

End Sub

Thanks....
 
Strange as this may sound, the ADO method "Clone" returns a DAO recordset. You have to use FindFirst instead of Find.
 

Users who are viewing this thread

Back
Top Bottom