Results 1 to 6 of 6

Thread: FindFirst

  1. #1
    Star Lounger
    Join Date
    Jan 2001
    Location
    Kansas, USA
    Posts
    73
    Thanks
    0
    Thanked 0 Times in 0 Posts

    FindFirst

    I can't figure out why FindFirst won't work in the following code. I have a table called tblPurchaseOrders and I have a combo box on frmReceivePurchaseOrders in which I want to enter the PO number into the combo box cboMoveTo and selects the correct record.

    Private Sub cboMoveTo_AfterUpdate()
    Dim rst As Recordset
    Set rst = Me!RecordsetClone
    rst.findfirst "tblPurchaseOrders.PONum = " & Me![cboMoveTo] & ""
    If Not rst.nomatch Then Me.Bookmark = rst.Bookmark
    End Sub

    I keep getting the message: Compile error: Method or data member not found.

  2. #2
    WS Lounge VIP rory's Avatar
    Join Date
    Dec 2000
    Location
    Burwash, East Sussex, United Kingdom
    Posts
    6,280
    Thanks
    3
    Thanked 191 Times in 177 Posts

    Re: FindFirst

    Hi,
    As far as I know the ADO recordset object does not have a findfirst method - the DAO one does. You could try removing the reference to ADO and replacing it with DAO (assuming you're not already using ADO-specific features.)
    Hope that helps.
    Regards,
    Rory

    Microsoft MVP - Excel

  3. #3
    Star Lounger
    Join Date
    Jan 2001
    Location
    Kansas, USA
    Posts
    73
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: FindFirst

    Rory, where do you specify ADO or DAO? As far as I know, I haven't specified either. Where would I insert this code:
    Dim db as DAO.Databse
    Set db = CurrentDB()

  4. #4
    WS Lounge VIP rory's Avatar
    Join Date
    Dec 2000
    Location
    Burwash, East Sussex, United Kingdom
    Posts
    6,280
    Thanks
    3
    Thanked 191 Times in 177 Posts

    Re: FindFirst

    Gary,
    From within the VB Editor choose Tools-References. I assume you're using Access2000 as it uses ADO by default. Deselect the ADO library (it's listed as ActiveX Data Objects) and select Microsoft DAO 3.6 instead. You shouldn't need to specify DAO before each object, but it would make it clearer to anyone else who may have to read your code.
    Hope that helps.
    Regards,
    Rory

    Microsoft MVP - Excel

  5. #5
    Star Lounger
    Join Date
    Jan 2001
    Location
    Kansas, USA
    Posts
    73
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: FindFirst

    Thanks so much Rory, I probably would have looked forever for a solution to that problem. Earlier applications where I have used that code were started in Access for W95 and some are still there. Thanks again![img]/w3timages/icons/smile.gif[/img]

  6. #6
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: FindFirst

    Specifying the object model also means that you can add back the ADO reference without confusing Access when you want to use some of the nifty stuff only available through ADO.
    Charlotte

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •