Problems accessing a subform control...

B

Brad Pears

I have a form on which I have a subform that has a control who's "visible"
property I want to set on load of the main form.

I have tried the following syntax but I keep getting an error stating it
cannot find the form I am referring to...

Main Form Name: frmPricing
Sub Form: frmMenuItems
Control Name: lbNext1

Here's my syntax to set the lblNext1 property...

'Forms![frmPricing]![frmMenuItems].Form.lblNext1.Visible = True

The error I get is ....

"Microsoft Access can't find the form 'frmMenuItems' referred to in a macro
expression or Visual Basic code."

Any help would be most appreciated...

Thanks,

Brad
 
D

Dirk Goldgar

Brad Pears said:
I have a form on which I have a subform that has a control who's
"visible" property I want to set on load of the main form.

I have tried the following syntax but I keep getting an error stating
it cannot find the form I am referring to...

Main Form Name: frmPricing
Sub Form: frmMenuItems
Control Name: lbNext1

Here's my syntax to set the lblNext1 property...

'Forms![frmPricing]![frmMenuItems].Form.lblNext1.Visible = True

The error I get is ....

"Microsoft Access can't find the form 'frmMenuItems' referred to in a
macro expression or Visual Basic code."

Any help would be most appreciated...

Thanks,

Brad

Most likely, the name of the subform control -- the control on the main
form that is displaying the form named "frmMenuItems" -- isn't actually
"frmMenuItems". Check the name of that control, and use it in place of
"frmMenuItems" in your reference.
 
B

Brad Pears

You got it - that was the problem!!!

Thanks
Dirk Goldgar said:
Brad Pears said:
I have a form on which I have a subform that has a control who's
"visible" property I want to set on load of the main form.

I have tried the following syntax but I keep getting an error stating
it cannot find the form I am referring to...

Main Form Name: frmPricing
Sub Form: frmMenuItems
Control Name: lbNext1

Here's my syntax to set the lblNext1 property...

'Forms![frmPricing]![frmMenuItems].Form.lblNext1.Visible = True

The error I get is ....

"Microsoft Access can't find the form 'frmMenuItems' referred to in a
macro expression or Visual Basic code."

Any help would be most appreciated...

Thanks,

Brad

Most likely, the name of the subform control -- the control on the main
form that is displaying the form named "frmMenuItems" -- isn't actually
"frmMenuItems". Check the name of that control, and use it in place of
"frmMenuItems" in your reference.

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)
 

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