drilling down to the subform syntax

G

Guest

Hi,

I have a sub procedure on my main form.
I would like to get the value for a particular column in my subform.

what would the syntax be if my subform control was called subformMain
and the form in the subform was called form_Main ?

I also would like the value of the column of the currently selected record
in the
sub form if there might be extra code to get this.

thank you

Chris
 
J

John Vinson

Hi,

I have a sub procedure on my main form.
I would like to get the value for a particular column in my subform.

what would the syntax be if my subform control was called subformMain
and the form in the subform was called form_Main ?

I also would like the value of the column of the currently selected record
in the
sub form if there might be extra code to get this.

From code on the mainform the syntax would just be

Me!sbformMain.Form!controlname

where controlname is the name of the textbox or other control bound to
the desired field in the subform's recordsource. By default this is
the fieldname in the Recordsource table or query, and the fieldname
will work even if there is no control (or a differently named control)
bound to it.

John W. Vinson[MVP]
 
M

Marshall Barton

Chris said:
I have a sub procedure on my main form.
I would like to get the value for a particular column in my subform.

what would the syntax be if my subform control was called subformMain
and the form in the subform was called form_Main ?

I also would like the value of the column of the currently selected record
in the
sub form if there might be extra code to get this.


For main form code to refer to a control in the current
record in a subform:

xxx = Me.subformMain.Form.controlname
 

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

Top