Connecting Tech Pros Worldwide Forums | Help | Site Map

Referring to a control in the subform footer

Familiar Sight
 
Join Date: Mar 2008
Posts: 166
#1: Dec 10 '08
Hello:

I would like to use information on one form to populate another form. There are 2 controls I would like to transfer; a list box control and a text box control. both are unbound controls in the subform footer of the form F_MixDesign.
Form1: F_MixDesign
Subform1: SF_MixSample
Control name: txtWaterReqWt

Form2:FSampleRequest
Subform2: SF_SampleRequest
Control name: txtWater

Both the control I would like to copy and the control that will be copied to are in the subform footers.

I have a button on form1 that when clicked will open form2. Here is my code, but I know it's wrong because it doesn't work.

Private Sub btnOpenSampReq_Click()

DoCmd.OpenForm "F_SampleRequest"
'Open F_Sample Request

Forms!F_SampleRequest.Controls!txtWater = Forms!F_MixDesign.Controls!ListWater
Forms!F_SampleRequest.Controls!txtWatReqWt = Forms!F_MixDesign.Controls!txtWaterReqWt
End Sub

I have also tried using:
Me!SF_SampleRequest.Controls!txtWater = Me!SF_MixDesign.Controls!ListWater

Expert
 
Join Date: Jul 2008
Location: Maryland
Posts: 1,176
#2: Dec 10 '08

re: Referring to a control in the subform footer


From here:
Forms: Refer to Form and Subform properties and controls

Forms!Mainform!Subform1.Form!ControlName = Me!Subform1.Form!ControlName

so

Forms!FSampleRequest!SF_SampleRequest.Form!txtWate r = SF_MixSample.Form!txtWaterReqWt
Familiar Sight
 
Join Date: Mar 2008
Posts: 166
#3: Dec 10 '08

re: Referring to a control in the subform footer


Chip,

You are wonderful! Thank you.

I tried to use that reference initially, but I can't understand it really...thank you
Reply