prepopulating an id field on a subform from the id field on main f

G

Guest

I have a database that has 5 different tables (A,B,C,D,E). Each table has a
primary key field called id. We needed data entry to be done using one form.
So I created the main form using the fields found on table A. I created
subforms on this main form so I could add the fields from tables B-E (joined
on id). Ideally we would like the users to enter the id only once (on the
main form, table a, id field). Once they have done that, we would like that
value to be prepopulated onto the subsequent subforms (tables B-E, each id
field). We do NOT want the users to be able to choose an id number on these
subforms using a combo box, as this is what it is currently doing. We just
want the number to appear in each of the subsequent tables/subforms. I know
this can be done, but is there an easy way to do this? Any help would be
appreciated.
 
M

Marshall Barton

laingram said:
I have a database that has 5 different tables (A,B,C,D,E). Each table has a
primary key field called id. We needed data entry to be done using one form.
So I created the main form using the fields found on table A. I created
subforms on this main form so I could add the fields from tables B-E (joined
on id). Ideally we would like the users to enter the id only once (on the
main form, table a, id field). Once they have done that, we would like that
value to be prepopulated onto the subsequent subforms (tables B-E, each id
field). We do NOT want the users to be able to choose an id number on these
subforms using a combo box, as this is what it is currently doing. We just
want the number to appear in each of the subsequent tables/subforms. I know
this can be done, but is there an easy way to do this? Any help would be
appreciated.


If all these tables are related by the ID field and the ID
field is the primary key of each table, then the tables are
in a one-to-one relationship. This is a somewhat unusual
arrangement, so I'm curious as to why you need this kind of
relationship.

Regardless, you can use the subform control's Link
Master/Child properties to get the subform to display the
record in the subform that's related to the main form
record. When you add a new record in a subform, the ID
field will be filled in automatically. In fact, the normal
practice is to not even make the subform's ID control
visible since it will just be a duplicate value of the ID on
the main 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