Referencing Data in One Subform From Another Subform?

H

HumanJHawkins

I have a main form with two subforms in it. They are not two levels
deep... Just two subforms side by side.

The main from is not bound to any data. Just a combo box there has a
list of recordsets to populate Subform1 with. Once the recordset is
chosen and populated into subform1, the user can select a specific
record on Subform1. It is this selection that I wish to base the data
in Subform 2 on.

I have studied (and tried all sorts of variations on) the following
tutorial on referencing data in one form from another:
http://www.mvps.org/access/forms/frm0031.htm

However, nothing works for setting a value from subform1 as the Link
Master Field for Subform2. What I tried to do was this:

Link Child Field: fkItem (Which is a field in the dataset for
subform2)
Link Master Field: Parent.Subform1.pkItem (pkItem being a field in
the dataset for subform1)

I also tried putting "Me." before parent, and using "!" instead of
".", as well as putting square brackets around field names, etc.
Nothing seems to work.

Is this not possible?
Thanks in advance for any help.
 
S

Stuart McCall

HumanJHawkins said:
I have a main form with two subforms in it. They are not two levels
deep... Just two subforms side by side.

The main from is not bound to any data. Just a combo box there has a
list of recordsets to populate Subform1 with. Once the recordset is
chosen and populated into subform1, the user can select a specific
record on Subform1. It is this selection that I wish to base the data
in Subform 2 on.

I have studied (and tried all sorts of variations on) the following
tutorial on referencing data in one form from another:
http://www.mvps.org/access/forms/frm0031.htm

However, nothing works for setting a value from subform1 as the Link
Master Field for Subform2. What I tried to do was this:

Link Child Field: fkItem (Which is a field in the dataset for
subform2)
Link Master Field: Parent.Subform1.pkItem (pkItem being a field in
the dataset for subform1)

I also tried putting "Me." before parent, and using "!" instead of
".", as well as putting square brackets around field names, etc.
Nothing seems to work.

Is this not possible?
Thanks in advance for any help.

The problem is that the LinkMasterField(s) must exist on the main form, not
another subform. The workaround is to place a textbox on the main form
(let's call it txtMaster) and set its ControlSource to:

=Subform1ControlName.Form!ComboBoxName

You can also hide it by setting Visible to No. Then set subform2's
LinkMasterField to txtMaster.
 
H

HumanJHawkins

The problem is that the LinkMasterField(s) must exist on the main form, not
another subform. The workaround is to place a textbox on the main form
(let's call it txtMaster) and set its ControlSource to:

=Subform1ControlName.Form!ComboBoxName

You can also hide it by setting Visible to No. Then set subform2's
LinkMasterField to txtMaster.- Hide quoted text -

- Show quoted text -

Thanks! That worked perfectly.
 

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