If your table design is right, and you're adding a new record, you can use AutoLookup and not have to write any code.
The field in question must be a foreign key to a table (call it Customers), and that table must be joined by that key to the table in which you're inserting the new record (call it Orders). Any other controls bound to fields of the Customers table will automatically be filled in when you update the foreign key. That's AutoLookup.
Caution: If any fields from the Customers table are enabled and unlocked, the user can update the Customers table using your form. That's usually not a good idea--updates to the Customers table should generally have their own form. So typically, you would make the Customers fields locked and disabled. However, it's up to you.
So, does AutoLookup work for you, or is your table structure something else? If so, describe the form's underlying recordset (best way is to give the equivalent SQL statement), and identify the fields you want filled, including which table each comes from.
Rick Sprague
Want the best answers? See faq181-2886
To write a program from scratch, first create the universe. - Paraphrased from Albert Einstein