Results 1 to 2 of 2
  1. #1
    Lounger
    Join Date
    Mar 2003
    Posts
    46
    Thanks
    0
    Thanked 0 Times in 0 Posts

    DLookup (Access 2K)

    Does anyone know if there is a way to do lookup on a table which primary key is not a numeric value? If there is not what would be the best way to autofill a second field based on the result of the first field. For e.g I have a list of vets in our area. when a user select a vet name froma dropdown box (each vet is unique), I would like for the street address, city and state to be automatically filled in the appropriate fields on a form. many thanks for your help.

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

    Re: DLookup (Access 2K)

    I assume that your form is based on a table now. You don't need the vet's address data in this table - it is redundant information.
    <UL><LI>Create a query based on that table and the vets table.
    <LI>Join the tables on the vet name field, then double click the join and select the option to display all records from the first table.
    <LI>Add all fields from the first table to the query grid, plus the fields you need (street, city, state) from the vets table.
    Note: it is important that the vet name field in the query grid is the one from the first table, not from the vets table.
    <LI>Save the query.
    <LI>Set the record source of the form to the query you just saved.
    <LI>Set the control source of the street, city and state text boxes on the form to the corresponding fields from the query.[/list]Now, if you select a vet name from the combo box (dropdown box), the address will be filled in automatically.

Posting Permissions

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