Question About AutoLookup Queries

G

Gavin Ziegler

I have two tables in a "one to many" relationship query.

The key field (the related field) on the "one side" is a
Primary AutoNumber field. When I add a new record in the
query, a new number is automatically generated on the "one
side" with no problem.

However, how do I get the related field on the "many side"
to automatically update with this new number?

Thanks.
 
A

Albert D. Kallal

The easy way is to build a form (you never let people edit the raw tables
anyway..right!).

So, you build a main form, and base it on the "parent" record (the one
side). You then have a many side, and thus need to give the user a natural
way to add "many". Thus, you can use a sub-form. If you use a sub-form, then
ms-access will automatically set the this foreign key value to the parent
record for you.

If you do NOT use sub-form, but other means (like some button that launches
another form), then YOU HAVE to set the value of the field used for the
relation yourself (or via some code).

So, the standard way is to use a sub-form.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top