João serras-pereira
asked on
ms/acceee link a subform to a control
Hi.
I am developing a form that contains 2 subforms. The first subform contains a list of records that, when a make a specific record "current", by clicking on it, I want to see all details on the right subform that is a single form, not a list.
the master form for both, contains a control that is updated every time I make a new record current on the list form and it works perfectly.
However, this masterform control is "unbound" to a Table/Query as I just want to select a specific record to show the detail, and do not want to change the content of the record itself.
is there a manner to link a subform field to this control?
alternatively:
if I bind the control to the table/query, is there a manner to make the "current" record in the list subform, a current record on the master form, so the master/child relation can work for the other form?
thanks in advance
(I am embedding a screenshot of the form where you may see the master form with a now visible and correct key, and both e list subform (on the left) and the single subform (on the right)
thanks in advance
I am developing a form that contains 2 subforms. The first subform contains a list of records that, when a make a specific record "current", by clicking on it, I want to see all details on the right subform that is a single form, not a list.
the master form for both, contains a control that is updated every time I make a new record current on the list form and it works perfectly.
However, this masterform control is "unbound" to a Table/Query as I just want to select a specific record to show the detail, and do not want to change the content of the record itself.
is there a manner to link a subform field to this control?
alternatively:
if I bind the control to the table/query, is there a manner to make the "current" record in the list subform, a current record on the master form, so the master/child relation can work for the other form?
thanks in advance
(I am embedding a screenshot of the form where you may see the master form with a now visible and correct key, and both e list subform (on the left) and the single subform (on the right)
thanks in advance
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
This is automatic.
On the main form:
Form unbound.
fld_codigoTicket is unbound (as now)
On the left subform:
Have this code in the OnCurrent event:
Me.Parent!fld_codigoTicket .Value = Me!codigoTicket.Value
Set Master/Child link fields to left subform:
Empty.
Set Master/Child link fields to right subform:
MasterLink: fld_codigoTicket
ChildLink: codigoTicket
/gustav
On the main form:
Form unbound.
fld_codigoTicket is unbound (as now)
On the left subform:
Have this code in the OnCurrent event:
Me.Parent!fld_codigoTicket
Set Master/Child link fields to left subform:
Empty.
Set Master/Child link fields to right subform:
MasterLink: fld_codigoTicket
ChildLink: codigoTicket
/gustav
ASKER
a big THANKS!!!!!
you're welcome ~ happy to help
after looking up one of my past projects, I see that all I did was use an unbound textbox on the mainform for LinkMasterFields of the second subform with this equation:
Unlike LinkChildFields, which must be a field(s) in the RecordSource and better to be in a control(s) on the subform (Visible can be No), LinkMasterFields can be an unbound control(s).
=nz(subform_controlname1.form.controlname)
No requery is needed in code behind the first subform -- Access does everything automaticallyUnlike LinkChildFields, which must be a field(s) in the RecordSource and better to be in a control(s) on the subform (Visible can be No), LinkMasterFields can be an unbound control(s).
ASKER
thanks!!
you're welcome ~
ASKER
now I am scratching my head...
the unbound control name is [fld_codigoTicket] but I can't figure ou a manner to link this to the subform... In the menu is just allows me to link IF the field is bound...
please check the screenshots