Results 1 to 3 of 3
  1. #1
    2 Star Lounger
    Join Date
    Sep 2006
    Posts
    166
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Find first (Access 2000)

    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

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

    Re: Find first (Access 2000)

    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

  3. #3
    2 Star Lounger
    Join Date
    Sep 2006
    Posts
    166
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Find first (Access 2000)

    really grateful ! Thanks a lot !

Posting Permissions

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