Results 1 to 3 of 3
  1. #1
    2 Star Lounger
    Join Date
    Apr 2003
    Posts
    139
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Requerying -> Moving to a Different Record (2000)

    Hi,

    I'm creating a form that takes a barcode that a user will input and then looks up information in a query and then deliver that information in a text box. For example, a user will input a patron barcode. This will execute a query that will look up the patron's first & last names and then place those in 2 separate text boxes below the patron barcode. That is all working fine. The problem is after I execute the requery by pressing the "Tab" key on my keyboard -- the form jumps to the first record in the table that the form is attached to.

    Here's my code:

    Private Sub txtBarcode_LostFocus()
    On Error GoTo Err_txtBarcode_Click

    DoCmd.Requery (Me.txtFirstName)
    DoCmd.Requery (Me.txtLastName)
    DoCmd.Requery (Me.txtTitle)

    Exit_txtBarcode_Click:
    Exit Sub

    Err_txtBarcode_Click:
    MsgBox Err.Description
    Resume Exit_txtBarcode_Click

    End Sub

    The tab properties are:
    Auto Tab = No
    Tab Stop = Yes
    Tab Index = 2

    Can someone help me figure out what I'm doing wrong?

    Thanks,
    Kindra

  2. #2
    Gold Lounger
    Join Date
    Jun 2001
    Location
    Crystal Beach, FL, Florida, USA
    Posts
    3,436
    Thanks
    1
    Thanked 34 Times in 34 Posts

    Re: Requerying -> Moving to a Different Record (2000)

    I don't understand what purpose the Requeries are serving. You said you have a query that delivers the info to the text boxes, so no requery is needed.

    Another choice would be to use a combobox for entry of the barcode. Column 1 would be the barcode, Column 2 the patron's first name, and column3 the patron's last name; set the column widths to something like 1";0";0". The controlsource for txtFirstName would be =cboBarCode.Column(1) and for txtLastName it would be =cboBarCode.Column(2). This way, no requerying would be necessary.
    Mark Liquorman
    See my website for Tips & Downloads and for my Liquorman Utilities.

  3. #3
    2 Star Lounger
    Join Date
    Apr 2003
    Posts
    139
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Requerying -> Moving to a Different Record (2000)

    The only purpose the requerying serves is so that I can write an event procedure -- otherwise I will enter in the patron barcode and then tab out of the field and it doesn't do anything -- re: display the data in my text boxes.

    I will try the combo box idea and let you know how it goes!
    Kindra

Posting Permissions

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