Linking subform to main form

  • Thread starter injanib via AccessMonster.com
  • Start date
I

injanib via AccessMonster.com

I have a form called "frmInvoice". The field does not have an autonumber
field, however it has a field called "txtInvoice" which is for the invoice
numbers and is uniquely generated.

In this form is a subform called "frmDescription". This form is in multiple
format and is where I enter the description of items such is qty, unit price,
total etc... There could be multiple records in this subform for the same
invoice number in the parent form.
I would like to link the subform to the main form such that when I open a
specific invoice, it also shows the related items in the subform. This
information will later be translated to a report.

I tried creating a new field in the table and form of the subform and set its
default value to that of the "txtInvoice" of the main form and used that
field to link, but I am not sure if I did it right. I am not sure what the
"Link master field" and "Link child field" under the Data tab of the
subform's property do.

How can I accomplish this.
 
J

June7 via AccessMonster.com

Sounds like you almost have all the elements set up. Enter the field name of
the key field in the main table into Link Master Field and field name from
the subform table that has the same value into the Link Child Field. These
fields don't have to be the same name, just contain the same value to link.
This linking will keep the datasets synced. The field in the subform table
cannot be defaulted to the value of the main form, it must actually have that
value stored in the table. If this field was added as an afterthought, must
populate that field for existing records. As records are created with the
form, that field will be populated with the key value as controlled by the
master/child link.
 

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