Results 1 to 3 of 3
  1. #1
    Silver Lounger
    Join Date
    Jan 2002
    Posts
    1,615
    Thanks
    0
    Thanked 1 Time in 1 Post

    Finding Autonumber from unbound control (2000)

    Hi,

    I have a form where the user does a search to find a record by it's autonumber. Presently there is an undbound text boxl called [invoice#] and a control button that is labeled 'Find Invoice #". The [autonumber] control is also on the form and will eventually be hidden. The goal is for the user to enter the invoice number, click the button and the code behind the button should take them to the record in listed in [invoice#]. I'm stuck on the code.

    Thanks!

    Leesha

  2. #2
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Sint Niklaas, Belgium
    Posts
    2,778
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Finding Autonumber from unbound control (2000)

    Use this code :
    Private Sub YourButton_Click()
    Me.RecordsetClone.FindFirst "[AutoNumberField] = " & Me.[Invoice#]
    Me.Bookmark = Me.RecordsetClone.Bookmark
    End Sub

    Two remarks:
    If your invoice number is an autonumber you'll be soon or later in problem because an autonumber can have gaps in the numbering.
    Avoid to use special characters like # in the naming of you fields and controls. In VBA those characters can have some meaning. Just use alphanumeric characters and underscore.
    Francois

  3. #3
    Silver Lounger
    Join Date
    Jan 2002
    Posts
    1,615
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Finding Autonumber from unbound control (2000)

    Thank you!!!

Posting Permissions

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