controlling sub form controls

  • Thread starter Thread starter Patrick
  • Start date Start date
P

Patrick

hi there,

i am working on a project that requires several forms. I am not sure if
this is the best way to do this, but I have a main form, which contains
4 seperate subforms. Each subform has a tag assigned to it, and only
one is displayed at a time, depending on which button is pressed on the
main form.

this all seems to work great, however when it comes to populating the
subform controls, nothing happens. I have pulled information from the
database, and put it all into variables. When I msgbox the variables,
they display the desired information, but when i try to assign that
information to controls on the subform, nothing happens.

it should be possible to control the subform controls shouldnt it? if
so, does anyone have any insight into what i might be doing wrong?

thanks

Patrick
 
Hi Patrick,

If you have a variable V declared in the main form's module, code
running in the main form's module can set a control on a subform using
syntax like this:

Me.Controls("NameOfSubform").Form.Controls("NameOfControl").Value = V

or the shortcut syntax

Me![NameOfSubform]![Form]![NameOfControl]

But it's more common for subforms to fetch their own data, usually by
being bound to a table or query.
 
Back
Top