Referance sub form control value

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

Guest

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
 
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
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top