Results 1 to 2 of 2
  1. #1
    2 Star Lounger
    Join Date
    Jun 2002
    Posts
    114
    Thanks
    0
    Thanked 0 Times in 0 Posts

    FindFirst (Access 2000)

    Can somebody help me with the FindFirstr method? I have a ListBox called ListInvoices, enumerating the payments and the clients.
    The row source of my listbox is the following:
    strBas = "SELECT orders.paymentid, orders.invoicedate, Payments.CompanyName, orders.Paymentid, orders.paymentid, Payments.afid " & _
    " FROM Payments INNER JOIN orders ON (Payments.Paymentid = orders.Paymentid) AND (Payments.Paymentid = orders.Paymentid) " & _
    "WHERE (((orders.orderid)>0) AND ((orders.paymentid)>0) AND ((orders.Paymentid) " & strNotIn & " "

    I have tried with the following code,put in the OnClick event of a control:

    Dim rst As DAO.Recordset, strCriteria As String
    Dim strPaymentID As String
    strPaymentD = InputBox("Please enter Payment number ")
    If Len(strPaymentID) > 0 Then
    strCriteria = "ListInvoices = " & strPaymentID
    Else
    Exit Sub
    End If
    Set rst = Me.RecordsetClone
    rst.FindFirst strCriteria
    If rst.NoMatch Then
    MsgBox "PaymentID " & strPaymentID & " Not Found!!"
    Else
    Me.Bookmark = rst.Bookmark
    End If


    When i click the control, it asks me for the payment number, but then noting happens,no error, but i do not go to the specified number.

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: FindFirst (Access 2000)

    ListInvoices is a control on your form, but not a field in its record source, so

    <font face="Georgia">strCriteria = "ListInvoices = " & strPaymentID</font face=georgia>

    is not a valid criteria string. Try changing it to

    <font face="Georgia">strCriteria = "PaymentID = " & strPaymentID</font face=georgia>

Posting Permissions

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