Relational forms

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

I've got a form with button on it that opens a second form. The second form
displays all the child records from the first form's selected record. Let's
say the tables are linked via columns named Table1_ID in both tables. If the
second form is showing all records where Table1_ID = 1, then I want any new
records created in that form to automatically have the value 1 in the
Table1_ID column. How can I do this?

Thanks,
Nathan
 
Nathan,

You can have what's called a "subform". Since you've already created the two
forms, you're 90% there.

All you have to do is open the "main" form in design view, then drag the
"subform" onto it from the Database Window. Once you've done that, select
the subform, and examine the [Link Child Fields] and [Link Master Fields]
properties. If they're not already filled out, set the same value -
Table1_ID.

Having done that, you can do away with the button that used to open the
subform, and you no longer need to enter a value in the subform's Table1_ID
field (Access will do it for you). In fact, although you need it to exist on
the form, you don't need to display it, so set its Visible property to
False.

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia

Microsoft Access 2003 VBA Programmer's Reference
http://www.wiley.com/WileyCDA/WileyTitle/productCd-0764559036.html
 
Back
Top