2 Related field or Auto fill up 2nd field after 1st field entered

Discussion in 'Microsoft Access Getting Started' started by Guest, Sep 17, 2006.

  1. Guest

    Guest Guest

    I have 2 related field in a transaction table
    Example "Taxi Number" (1st Field) "Taxi Driver" (2nd Field)
    Let say i have a table having latest or default Driver driving which taxi
    record as per below

    TaxiNumber TaxiDriver
    New York 1111 Micheal
    New York 2222 Jodan
    .....

    Now if i entred New York 1111 into "Taxi Number" (1st Field) in the
    transaction table can "Taxi Driver" (2nd Field) auto filling with Micheal
    into the field? but i still able to change "Taxi Driver" (2nd Field) as Jadan
    or other driver because maybe today he taking leave and replace by other
    driver.

    TaxiNumber TaxiDriver
    New York 1111 (after entered) Micheal (auto filled but still able
    to change to other
    driver)
     
    Guest, Sep 17, 2006
    #1
    1. Advertisements

  2. How are you entering the taxi number?

    If you're using a combo box (which would be the preferred approach), make
    sure that the combo box also contains the driver name, even if it isn't
    displayed. In the AfterUpdate event of the combo box, put code like:

    Private Sub cboTaxiNumber_AfterUpdate()
    Me.txtTaxiDriver = Me.cboTaxiNumber.Column(1)
    End Sub

    This assumes that the driver name is the 2nd column in the combo box (the
    Column collection starts numbering at 0)

    If you're using a text box, you'll need to do a look-up in the AfterUpdate
    event. You should be able to use something like:

    Private Sub txtTaxiNumber_AfterUpdate
    Me.txtTaxiDrive = DLookup("[TaxiDriver]", "[Drivers]", "[TaxiNumber] = '"
    & Me.txtTaxiNumber & "'")
    End Sub

    cboTaxiNumber is supposed to be the name of the combo box being used if
    that's the route you're going while txtTaxiNumber would be the name of the
    text box you key the taxi number into if using that route. txtTaxiDriver is
    the text box to hold the driver name. I've assumed that the data is stored
    in a table named Drivers, and that the relevant fields in that table are
    TaxiNumber and TaxiDriver. Replace those names with whatever your actual
    names are.

    --
    Doug Steele, Microsoft Access MVP
    http://I.Am/DougSteele
    (no private e-mails, please)


    "Kaoli" <Kaoli @discussions.microsoft.com> wrote in message
    news:...
    >I have 2 related field in a transaction table
    > Example "Taxi Number" (1st Field) "Taxi Driver" (2nd Field)
    > Let say i have a table having latest or default Driver driving which taxi
    > record as per below
    >
    > TaxiNumber TaxiDriver
    > New York 1111 Micheal
    > New York 2222 Jodan
    > ....
    >
    > Now if i entred New York 1111 into "Taxi Number" (1st Field) in the
    > transaction table can "Taxi Driver" (2nd Field) auto filling with Micheal
    > into the field? but i still able to change "Taxi Driver" (2nd Field) as
    > Jadan
    > or other driver because maybe today he taking leave and replace by other
    > driver.
    >
    > TaxiNumber TaxiDriver
    > New York 1111 (after entered) Micheal (auto filled but still
    > able
    > to change to
    > other
    > driver)
     
    Douglas J. Steele, Sep 17, 2006
    #2
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Guest

    Can related Access form fields autofill after 1 field is entered?

    Guest, Nov 15, 2005, in forum: Microsoft Access Getting Started
    Replies:
    2
    Views:
    214
    Guest
    Nov 15, 2005
  2. Guest

    How to auto fill information from a main form to 2 related forms?

    Guest, Dec 15, 2005, in forum: Microsoft Access Getting Started
    Replies:
    3
    Views:
    191
  3. Guest

    is data entered in one field supposed to appear in another field .

    Guest, Feb 5, 2006, in forum: Microsoft Access Getting Started
    Replies:
    2
    Views:
    247
    jacksonmacd
    Feb 5, 2006
  4. Guest

    How can I get a field to auto-fill based on another field?

    Guest, Aug 10, 2006, in forum: Microsoft Access Getting Started
    Replies:
    1
    Views:
    215
    Al Camp
    Aug 10, 2006
  5. NChap

    Data entry field calculated from manually entered field.

    NChap, Aug 6, 2009, in forum: Microsoft Access Getting Started
    Replies:
    1
    Views:
    321
    John W. Vinson
    Aug 6, 2009
Loading...

Share This Page