Referance sub form control value

A

Apples76

i want to be able to insert a value from a subform to an automatic email i am
creating.

could you please show me how to refence a subforms control in VB.

i am using Access 2K


Thanks
 
K

Klatuu

A point that may help you understand all references to subforms is that a
subform is a control on a form just like a text box, a check box, a list box,
a combo box, whatever. It is another type of control. A subform control has
a property named Source Object. The Source Object is the name for the form
that will be displayed in the subform control. So, to refer to the methods
and properties of the form that is the source object of the control, the
syntax is:

Forms!frmMyMainForm!subFormControlName.Form!MyControlName.

For example, we have
a form named frmClient
a subform control on frmClient named subClientServices
the source object for subClientServices is frmClientServices
a control on frmClientServices name txtServiceDate

Say we want to alert the user if the Service Date is within the next week:

If Me.subClientServices.Form!tstServiceDAte <= DateAdd("d",7,Date) And
 
S

Sprinks

Apples,

To add to Dave's post, to go the other way, i.e., to reference a main form
control from a subform, use the Parent property of the subform:

Me.Parent.Form![YourMainFormControl]

Sprinks
 
Top