SubForm via Combo Box

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

Guest

The basic problem is linking a subform to a main form via a "calculated"
field rather than a table field. On my main form I use a combo box (CID) to
select a three digit code associated with an employee. The third column of
this box is the employee's ID number, which I must use because multiple
people can have the same code. I have an unbound object (MasterEID) on the
main form that properly pulls column three (=CID.Column(3)). The subform
links via a bound object (RepEID). The subform works fine when I reference
the RepEID from both the main and subform because RepEID is in both tables.
However, the control source for the linked field needs to be the third column
of the combo box, not a field in the table. So, is there a way to link the
subform to the value displayed in an unbound text field? I am thinking an sql
statement in the afterupdate area of CID with a where clause referencing the
MasterEID field, however, I don't know how to do that for a sub form, nor do
I know if that is the proper solution. Any suggestions here would be greatly
appreciated. Thanks, Michael
 
apollo8359 said:
The basic problem is linking a subform to a main form via a "calculated"
field rather than a table field. On my main form I use a combo box (CID) to
select a three digit code associated with an employee. The third column of
this box is the employee's ID number, which I must use because multiple
people can have the same code. I have an unbound object (MasterEID) on the
main form that properly pulls column three (=CID.Column(3)). The subform
links via a bound object (RepEID). The subform works fine when I reference
the RepEID from both the main and subform because RepEID is in both tables.
However, the control source for the linked field needs to be the third column
of the combo box, not a field in the table. So, is there a way to link the
subform to the value displayed in an unbound text field? I am thinking an sql
statement in the afterupdate area of CID with a where clause referencing the
MasterEID field, however, I don't know how to do that for a sub form, nor do
I know if that is the proper solution. Any suggestions here would be greatly
appreciated.

You can use a comtrol on the main form in the
LinkMasterFields property. Sounds like you want to use the
name of the calculated text box.

If that doesn't do it, try removing the expression fromt the
text box an setting it in the combo box's AftrUpdate event.
 
Back
Top