Sourcing data from subform's selected record

bd528

Registered User.
Local time
Today, 09:15
Joined
May 7, 2012
Messages
111
I have a main form (frmMain) and a sub form (frmChild), set as datasheet.
The first field in the datasheet is set as a hyperlink and opens another form correctly. What I would like is if the user selects a record on frmChild, then a textbox on frmMain is populated by the corresponding value in the second column of the datasheet.
Is it possible to do this via vba, and if so, how? I've read about solutions by using continous forms, but I'd like to stay with datasheet format if possible.

Thanks in advance.
 
You can set the control source of the text box on the main form (I assume you are NOT trying to store the data in the main form's record source but just display it) to:

=IIf(Len([SubformControlNameHere].[Form]![ControlNameHere] & "") > 0, [SubformControlNameHere].[Form]![ControlNameHere], Null)

You could do it in VBA but is there really a need to do so?
 
Worked perfectly - thanks.
 

Users who are viewing this thread

Back
Top Bottom