View Single Post
  #2 (permalink)  
Old October 7th, 2003, 09:07 AM
Bob Bedell Bob Bedell is offline
Friend of Wrox
 
Join Date: Jun 2003
Location: , , USA.
Posts: 1,093
Thanks: 1
Thanked 12 Times in 11 Posts
Default

Hi T,

Be sure you have a reference set to the Microsoft DAO 3.x library, then change Dim recClone As Recordset to Dim recClone As DAO.Recordset (always fully qualify data access objects like this, with library.object syntax).

Your default library is ADO, the recordsets of bound forms in .mdb files are always DAO recordsets. So Set rst = Me.RecordsetClone always returns a DAO recordset in an .mdb file. (though recordsetClone returns an ADO recodset in an .adp file).

In fact, since Access (.mdb) knows that the return value of RecordsetClone is always a DAO recordset, code like:

Private Sub cboSearch_AfterUpdate()
    Dim rst As DAO.Recordset

    Set rst = Me.RecordsetClone

    rst.FindFirst "CustomerID=" & cboSearch
    Me.Bookmark = rst.Bookmark
     cboSearch = Null
End Sub

the above can be simplified to:

Sub cboSearch_AfterUpdate()
    Me.RecordsetClone.FindFirst "CustomerID=" & cboSearch
    Me.Bookmark = Me.RecordsetClone.Bookmark
    cboSearch = Null
End Sub

HTH,

Bob

Reply With Quote