automatically create records in multiple tables from a form

L

Lester Levine

I have a database with 50 tables. Each table is related
to each other through a field named "ID2". The tables
are related on a one-to-one relationship. when I open up
the database to add a new entry. After entering the "ID2"
how can I get Access to populate each other table with a
new record that contains its "ID2"?
 
D

Duane Hookom

I suppose you could run 50 append querys in the After Insert event of a form
bound to your main table.

This question sets off lots of red flags regarding your application and
table structures.
 
J

John Vinson

I have a database with 50 tables. Each table is related
to each other through a field named "ID2". The tables
are related on a one-to-one relationship. when I open up
the database to add a new entry. After entering the "ID2"
how can I get Access to populate each other table with a
new record that contains its "ID2"?

This is A VERY BAD IDEA and, I must say, a very non-normalized design!

What do these tables have in common? In what way are they different?
One to one relationships are VERY rare (useful for Subtyping, in which
case you would *not* have a placeholder record in any of the subtype
tables).

I think, in other words, that you're trying to solve the wrong
problem. The data in these tables should be susceptible to
normalization into a much smaller number of tables. Could you describe
the data that you're modeling so we could suggest a better table
structure?

Just to directly answer the question (and it's hard to type while
holding my nose :-{) ) you would write VBA code to open fifty
recordsets, use the AddNew method fifty times, set the ID2 field fifty
times, and use the Output method fifty times...
 

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