Problem with a control to show or hide fields between two subforms

H

Harperec

I have a continuous subform that lists subsections of a particular job
number(controlled by the main form), and a button control on each of
the continuous subforms to update the visible record in another
subform. The data of a particular combo box determines whether or not
certain fields will be visible or not. My ".Visible = True/False"
coding works perfectly when you click on the combo box, but I haven't
been able to figure out how to automatically check the value of that
combo box, and update the fields that are supposed to be visible or
not accordingly.

I would imagine that I need a script to "click" on the combo box in
question, but I keep getting a "error 438" when I use this attached to
the control within subform 1:

Forms![master form]![subform2].[combo box].Click


any ideas?

thanks.
 
K

Klatuu

Your problem is incorrect object referencing. When referencing a control on
a subform from code in the main form's code module, you refer to the subform
control on the main form, not the name of the form being used as the subform.
the correct reference syntax is:
Forms![master form]![subformControlName].[Form].[combo box].Click

The form reference tells Access to use the form identified in the subform
control's Source Object property.
 
H

Harperec

When you refer to "SubformControlName" in:

Forms![master form]![subformControlName].[Form].[combo box].Click

are you refering to the button within subform1 that will update
subform2? Also the [Form] portion.... that refers to subform2, where
the combobox is, correct?

thanks



Your problem is incorrect object referencing.  When referencing a control on
a subform from code in the main form's code module, you refer to the subform
control on the main form, not the name of the form being used as the subform.
 the correct reference syntax is:
Forms![master form]![subformControlName].[Form].[combo box].Click

The form reference tells Access to use the form identified in the subform
control's Source Object property.
--
Dave Hargis, Microsoft Access MVP



I have a continuous subform that lists subsections of a particular job
number(controlled by the main form), and a button control on each of
the continuous subforms to update the visible record in another
subform.  The data of a particular combo box determines whether or not
certain fields will be visible or not.  My ".Visible = True/False"
coding works perfectly when you click on the combo box, but I haven't
been able to figure out how to automatically check the value of that
combo box, and update the fields that are supposed to be visible or
not accordingly.
I would imagine that I need a script to "click" on the combo box in
question, but I keep getting a "error 438" when I use this attached to
the control within subform 1:
Forms![master form]![subform2].[combo box].Click
any ideas?
thanks.- Hide quoted text -

- Show quoted text -
 
H

Harperec

Using this:

Forms![master form]![subform1].Forms.[master form].[subform2].
[subform2 combo box].Click

I get the following message:

"runtime error '438'
Object doesn't support this property or method"

other ideas?
 

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