auto fill same key on same tables with one form

S

Sinatrasdame

I have 3 tables that I am entering data into on the same form.

I have the people table with name, date of birth...
There's an occupation table and a children table listing their kids

all three tables use an autonumber as their key and that number needs to be
the same so that they link together correctly. I want to be able to make the
numbers match. I tried making a form with 3 auto-number boxes on it, one for
each of the 3 tables. But only the first box gets a number put into it.

I think part of the problem is that I have the fields in the children table
looking up their values in the people table.
basicaly I'm new at this and the dummies book only got me so far, lol. If
anyone can help I'd really appreciate it.
 
J

John Vinson

I have 3 tables that I am entering data into on the same form.

I have the people table with name, date of birth...
There's an occupation table and a children table listing their kids

all three tables use an autonumber as their key and that number needs to be
the same so that they link together correctly. I want to be able to make the
numbers match. I tried making a form with 3 auto-number boxes on it, one for
each of the 3 tables. But only the first box gets a number put into it.

I think part of the problem is that I have the fields in the children table
looking up their values in the people table.
basicaly I'm new at this and the dummies book only got me so far, lol. If
anyone can help I'd really appreciate it.

You CANNOT - it's just *impossible* - to use an Autonumber for
linking. It simply will *not work*.

Instead, use an Autonumber for the Primary Key of the "main" table -
the people table in this case.

Each related table should have its own primary key (which can be an
autonumber or might be something else), but in *addition* to that
field, should have a Long Integer number field as a "foreign key" - a
link to the People table.

For data entry you would use a Form based on the People table, with
two subforms for the other tables. The Master Link Field property of
each subform would be the autonumber PeopleID; the Child Link Field
would be the foreign key field.

John W. Vinson[MVP]
 

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