• FindFirst

    Author
    Topic
    #352501

    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.

    Viewing 0 reply threads
    Author
    Replies
    • #512913

      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.

      • #512914

        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()

        • #512916

          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.

          • #512918

            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!

          • #512990

            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.

    Viewing 0 reply threads
    Reply To: FindFirst

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: