"Applying the AutoLookup Query will populate data from one related location to another. Simple to use and no coding required..."
The AutoLookup query works with related tables typically as a ('one' to 'many' relationship) and is the basis for data entry normally via a FormThere is no actual data being stored anywhere just a simple way to fill in data automatically requiring no coding at all and reduce the overall typing time. In my example below, I want to enter a new order and since the rule is that I must first choose an existing customer before placing the order, all I need to do is choose the 'Customer ID' and get the system to look up and populate the customer details automatically. The first step is to produce the query and then for completeness, I'm going to build a Form based on the query using the Form wizard feature.
Creating the AutoLookup Query requires two related tables in a 'one' to 'many' relationship and all the fields you want your final Form to be based on.If you need a reminder of how to create a query, here's a link to
how to create a select query
which explains all the components and options that you will need to be aware of. Step 1: Open the Database Window (version 2003 or earlier) or Navigation Pane (Access 2007 and later versions). Start a new blank query in 'Design View' mode and select the two tables and the associated fields required. Make sure that the joining field is correctly set for the AutoLookup query to work properly. So for example, the common field in my example is 'Customer ID' where it is unique (the 'one' side) from a table called 'Customers' and the duplicate value of 'Customer ID' field (the 'many' side) which is from the 'Orders' table - that I choose the 'many' side related field and not the 'one' side. Quickly run the query to check the data. Note: When using multiple tables/queries, make sure they have a relational join between them with no 'stand-alone' files present.

Step 2: In 'Datasheet View' mode, you can test out the response of the auto-lookup by adding a new record here.As soon as you type a known 'Customer ID' value for an existing account and press the ENTER key, the rest of the customer's profile is filled in for you. When you are satisfied this is working, close and save the query. Optional Step: Create a Form using the form wizard feature based on your new query and test it out again.

Close and save the changes.That's it - job done!
Return from AutoLookup Query to Access Queries
Return from AutoLookup Query to About Access Databases homepage
|