• Find first (Access 2000)

    Author
    Topic
    #437775

    Why is my function not working.I am not able to find the customer with this function :

    Dim f As Form
    Set f = Forms!FCustomers
    Dim strCustomerID As String
    strCustomerID = InputBox(“Enter customer number ? “)
    If strCustomerID = “” Then
    Exit Sub
    End If
    f.RecordsetClone.FindFirst “CustomerID = ” & strCustomerID
    If f.RecordsetClone.NoMatch Then
    MsgBox “customer ” & strCustomerID & ” does not exist!!”
    End If

    Viewing 0 reply threads
    Author
    Replies
    • #1041762

      Because you don’t do anything if the record is found. Access does not try to guess what you might have intended.

      Change

      If f.RecordsetClone.NoMatch Then
      MsgBox “customer ” & strCustomerID & ” does not exist!!”
      End If

      to

      If f.RecordsetClone.NoMatch Then
      MsgBox “customer ” & strCustomerID & ” does not exist!”
      Else
      ‘ Move to the record
      f.Bookmark = f.RecordsetClone.Bookmark
      End If

    Viewing 0 reply threads
    Reply To: Find first (Access 2000)

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

    Your information: