referencing subform controls

  • Thread starter Thread starter drabbacs
  • Start date Start date
D

drabbacs

I have a form which contains several subforms that display
data from queries in tabular format in text boxes. I want
to allow the user to be able to select one of the entries
and then press a command button to execute a macro-query
based on that selection.

As a quick example in the parent form, call it frm_Parent,
I have frm_sub1 and frm_sub2 subforms. In frm_sub1 I have
a text box which lists dates, call it DateBox. I want the
user to be able to select a particular entry from the
listings in DateBox and then press a command button or
alternatively they could double click the date and this
would execute the macro-query to give me detailed
information about that entry.

I used to have this information displayed in a listbox and
used the bound column and onDoubleClick property to feed
the macro-query. I moved away from that layout so I could
do some conditional formatting in the textboxes.

Is it possible to capture a selected entry in a textbox in
the same way as in a listbox? If so, how? How does one set
up a reference to a control in a subform using the forms!
[name_of_form].[name_of_control] format?

Any help is greatly appreciated.
Drabbacs
 
drabbacs said:
I have a form which contains several subforms that display
data from queries in tabular format in text boxes. I want
to allow the user to be able to select one of the entries
and then press a command button to execute a macro-query
based on that selection.

As a quick example in the parent form, call it frm_Parent,
I have frm_sub1 and frm_sub2 subforms. In frm_sub1 I have
a text box which lists dates, call it DateBox. I want the
user to be able to select a particular entry from the
listings in DateBox and then press a command button or
alternatively they could double click the date and this
would execute the macro-query to give me detailed
information about that entry.

I used to have this information displayed in a listbox and
used the bound column and onDoubleClick property to feed
the macro-query. I moved away from that layout so I could
do some conditional formatting in the textboxes.

Is it possible to capture a selected entry in a textbox in
the same way as in a listbox? If so, how? How does one set
up a reference to a control in a subform using the forms!
[name_of_form].[name_of_control] format?


Just refer to the text box instead of the list box.

main form refering to text box in main form
Me.[name_of_control]

main form refering to text box in subform
Me.subformcontrol.Form.[name_of_control]

subform refering to text box in main form
Me.Parent.[name_of_control]
 
Back
Top