2 subforms within a main subform

G

gg

I have 1 main form with 2 subforms.
1)Main form: has contract#(key), type (key)--this form displays info only.
2)Subform1: has contract#(key), type(key), line_item# (key)--this form
displays info only.
3)Subform2: has contract#(key), type(key), line_item# (key)--This subform2
is an input form.

How can I get the line_item# from Subform1 into Subform2 so when the user
cursor's thru each record in Subform1, the Subform2's record changes to match
with the line_item# in Subform1?

Help! Thank you.
 
J

John Vinson

I have 1 main form with 2 subforms.
1)Main form: has contract#(key), type (key)--this form displays info only.
2)Subform1: has contract#(key), type(key), line_item# (key)--this form
displays info only.
3)Subform2: has contract#(key), type(key), line_item# (key)--This subform2
is an input form.

How can I get the line_item# from Subform1 into Subform2 so when the user
cursor's thru each record in Subform1, the Subform2's record changes to match
with the line_item# in Subform1?

Set Subform2's Master Link Field to

[Contract#];Forms![Mainformname]![FirstSubformName].Form![Line_Item#]

and its Child Link Field to

[Contract#];[Line_Item#]

Note that you will almost surely get error messages like "the record
is currently locked by another user" if you're trying to display (with
the potential of editing, Access can't tell) the record in Subform1
and edit it also in Subform2. You may want to consider just using one
subform, and toggling its Allow Edits property on and off.

John W. Vinson[MVP]
 
G

gg

John Vinson said:
I have 1 main form with 2 subforms.
1)Main form: has contract#(key), type (key)--this form displays info only.
2)Subform1: has contract#(key), type(key), line_item# (key)--this form
displays info only.
3)Subform2: has contract#(key), type(key), line_item# (key)--This subform2
is an input form.

How can I get the line_item# from Subform1 into Subform2 so when the user
cursor's thru each record in Subform1, the Subform2's record changes to match
with the line_item# in Subform1?

Set Subform2's Master Link Field to

[Contract#];Forms![Mainformname]![FirstSubformName].Form![Line_Item#]

and its Child Link Field to

[Contract#];[Line_Item#]

Note that you will almost surely get error messages like "the record
is currently locked by another user" if you're trying to display (with
the potential of editing, Access can't tell) the record in Subform1
and edit it also in Subform2. You may want to consider just using one
subform, and toggling its Allow Edits property on and off.

John W. Vinson[MVP]
Hi John,

Thanks for your suggestions. Can you please explain what the Allow Edits
property will do? So even if the record in Subform1 is only for viewing, and
the Subform2 is for editing and saving, and they are related to 2 different
tables, is there a way to get this to work? My subform2 is going against a
Billing table. And Subform1 is going against the Contracts table.

Is there an alternate way to do this? I'm open to any suggestions and am
still learning. :)

Thank you!!

gg
 
G

gg

Somehow the Subform2 properties keep changing from the Linked Master and
Child under the Control Source to the Record Source (the Linked Master and
Child options disappear). What am I doing wrong?

gg said:
John Vinson said:
I have 1 main form with 2 subforms.
1)Main form: has contract#(key), type (key)--this form displays info only.
2)Subform1: has contract#(key), type(key), line_item# (key)--this form
displays info only.
3)Subform2: has contract#(key), type(key), line_item# (key)--This subform2
is an input form.

How can I get the line_item# from Subform1 into Subform2 so when the user
cursor's thru each record in Subform1, the Subform2's record changes to match
with the line_item# in Subform1?

Set Subform2's Master Link Field to

[Contract#];Forms![Mainformname]![FirstSubformName].Form![Line_Item#]

and its Child Link Field to

[Contract#];[Line_Item#]

Note that you will almost surely get error messages like "the record
is currently locked by another user" if you're trying to display (with
the potential of editing, Access can't tell) the record in Subform1
and edit it also in Subform2. You may want to consider just using one
subform, and toggling its Allow Edits property on and off.

John W. Vinson[MVP]
Hi John,

Thanks for your suggestions. Can you please explain what the Allow Edits
property will do? So even if the record in Subform1 is only for viewing, and
the Subform2 is for editing and saving, and they are related to 2 different
tables, is there a way to get this to work? My subform2 is going against a
Billing table. And Subform1 is going against the Contracts table.

Is there an alternate way to do this? I'm open to any suggestions and am
still learning. :)

Thank you!!

gg
 
J

John Vinson

Somehow the Subform2 properties keep changing from the Linked Master and
Child under the Control Source to the Record Source (the Linked Master and
Child options disappear). What am I doing wrong?

Are you looking at the properties of the Subform Control (the box on
the mainform which contains the subform)? or the properties of the
Form which is within that control? These are two separate objects,
each with their own properties.

To see the properties of the Subform Control, select it from the
dropdown list of controls at the left of the toolbar, or carefully
click on the *edge* of the subform box so it highlights.

To see the properties of the Form, click the little square at the
upper left intersection of the rulers within the subform.

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