Set control's visible property value on a nested subform

M

Mona-ABE

From a public function in a module in Access I'm trying to set the visible
property to false on a control on a nested subform. I have the main form
(frmModuleWeeklyReport) with a subform (Workstream Name, Status & Comments).
The subform (Workstream Name, Status & Comments) has a subform (Deliverable
Detail) which contains a control (SBDelivTargetDate) that I'd like to make
invisible when certain parameters are met. This is the code I wrote below
and I'm getting the error message #2455, "You entered an expression that has
an invalid reference to the property Form/Report."

Forms![frmModuleWeeklyReport]![Workstream Name, Status &
Comments].Form![Deliverable Detail].Form![SBDelivTargetDate].Visible = False

Please advise!
 
K

Ken Snell \(MVP\)

Syntax would be this (assuming that the subform names are correct):

Forms![frmModuleWeeklyReport]![Workstream Name, Status &
Comments]![Deliverable Detail]![SBDelivTargetDate].Visible = False


Be sure that you're using the names of the subform controls (the controls
that actually hold the subform object), which may or may not be the name of
the form that is being used as the subform object.
 
M

Mona-ABE

Thanks so much, Ken, for the quick reply!

I'm still getting the same error message using the recommended syntax. I
also went to each form, selected the subform control and copied the value in
its "Name" property (which were all the same as you had in your code). I
don't know what else to do.

Here's what I'm attempting...you may have a suggestion for a better
approach. The subform "Workstream Name, Status & Comments" containing the
nested subform "Deliverable Detail" is used on 2 different main forms. On
one, we need to display the target date field "SBDelivTargetDate", and on one
we want it to be invisible. The main forms vary in other ways, but they have
these subforms in common.

Any tips you provide would be greatly appreciated!
--
Thanks!
Mona-ABE


Ken Snell (MVP) said:
Syntax would be this (assuming that the subform names are correct):

Forms![frmModuleWeeklyReport]![Workstream Name, Status &
Comments]![Deliverable Detail]![SBDelivTargetDate].Visible = False


Be sure that you're using the names of the subform controls (the controls
that actually hold the subform object), which may or may not be the name of
the form that is being used as the subform object.
--

Ken Snell
<MS ACCESS MVP>




Mona-ABE said:
From a public function in a module in Access I'm trying to set the visible
property to false on a control on a nested subform. I have the main form
(frmModuleWeeklyReport) with a subform (Workstream Name, Status &
Comments).
The subform (Workstream Name, Status & Comments) has a subform
(Deliverable
Detail) which contains a control (SBDelivTargetDate) that I'd like to make
invisible when certain parameters are met. This is the code I wrote below
and I'm getting the error message #2455, "You entered an expression that
has
an invalid reference to the property Form/Report."

Forms![frmModuleWeeklyReport]![Workstream Name, Status &
Comments].Form![Deliverable Detail].Form![SBDelivTargetDate].Visible =
False

Please advise!
 
M

Mona-ABE

MY MISTAKE! YOUR SUGGESTION WORKED PERFECTLY!!!!
My error was in the order of the code. I placed it too early in the
procedure, before the data loaded. Since the form hadn't loaded all the
controls with their respective data, it didn't allow me to affect it's
properties.

Thank you very much for your help!
--
Thanks!
Mona-ABE


Ken Snell (MVP) said:
Syntax would be this (assuming that the subform names are correct):

Forms![frmModuleWeeklyReport]![Workstream Name, Status &
Comments]![Deliverable Detail]![SBDelivTargetDate].Visible = False


Be sure that you're using the names of the subform controls (the controls
that actually hold the subform object), which may or may not be the name of
the form that is being used as the subform object.
--

Ken Snell
<MS ACCESS MVP>




Mona-ABE said:
From a public function in a module in Access I'm trying to set the visible
property to false on a control on a nested subform. I have the main form
(frmModuleWeeklyReport) with a subform (Workstream Name, Status &
Comments).
The subform (Workstream Name, Status & Comments) has a subform
(Deliverable
Detail) which contains a control (SBDelivTargetDate) that I'd like to make
invisible when certain parameters are met. This is the code I wrote below
and I'm getting the error message #2455, "You entered an expression that
has
an invalid reference to the property Form/Report."

Forms![frmModuleWeeklyReport]![Workstream Name, Status &
Comments].Form![Deliverable Detail].Form![SBDelivTargetDate].Visible =
False

Please advise!
 

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