Referencing controls on a subform

  • Thread starter Thread starter Trevor
  • Start date Start date
T

Trevor

Here is an exerpt from Microsofts Access Help...

To refer to a subform or subreport property, you must type
a full identifier for the form or report by using the Form
or Report property of a subform or subreport control. For
example, the following identifier refers to the Visible
property of the Orders Subform subform:

Forms![Orders]![OrdersSubformControl].Form.Visible

********************************************************
On my computer, the above statement blows up, but if you
have....
Forms![Orders]![OrdersSubformControl].Visible
it works.

The help goes on to state...
********************************************************

In contrast, to refer to a control on a subform or
subreport, or one of the control's properties, you don't
have to use the Form or Report property. For example, the
following identifier refers to the Visible property of the
Discount control on the Orders Subform subform:

Forms![Orders]![OrdersSubformControl]![Discount].Visible

********************************************************
On my computer, this statement blows up, but if you have....
Forms![Orders]![OrdersSubformControl].Form![Discount].Visible
it works.
********************************************************

Am I going crazy here or am I just missing something?
Micrsoft has been stating this for a long time... For at
least 11 years now (Since I started developing Access
Datatbases) Obviously I've ignored the help and did what
worked. Just thought I'd post this and see what other
people say...
 
Where did you get that quote? What version and topic? It appears not to make
sense.

The reference:
Forms![Orders]![OrdersSubformControl].Visible
refers to whether the subform *control* is visible.
The reference:
Forms![Orders]![OrdersSubformControl].Form.Visible
is supposed to refer to the form within the subform control, but since that
is not part of the Forms collection, the reference makes no sense to me.

The reference:
Forms![Orders]![OrdersSubformControl].Form![Discount].Visible
refers to the control named Discount in the form that's in the subform
control.
The reference:
Forms![Orders]![OrdersSubformControl]![Discount].Visible
is technically not correct, but Access is sometimes forgiving and figures
out what you mean (which actually makes it harder to learn in my view).
 
Hey Allen,
Thanks for replying to this... Here are the details you
wanted...
I got the enclosed quotes from the Help in Access 2003.

Here are some of the links you can follow to find the
referenced information...
http://office.microsoft.com/assistance/hfws.aspx?AssetID=HP051868521033
http://office.microsoft.com/assistance/hfws.aspx?AssetID=HP051884791033
http://office.microsoft.com/assistance/hfws.aspx?AssetID=HP051869091033

I emailed you these pages in PDF. The info I'm referring
to is highlighted.

Let me know what you think.
Trevor Hebert


-----Original Message-----
Where did you get that quote? What version and topic? It appears not to make
sense.

The reference:
Forms![Orders]![OrdersSubformControl].Visible
refers to whether the subform *control* is visible.
The reference:
Forms![Orders]![OrdersSubformControl].Form.Visible
is supposed to refer to the form within the subform control, but since that
is not part of the Forms collection, the reference makes no sense to me.

The reference:
Forms![Orders]![OrdersSubformControl].Form![Discount].Visible
refers to the control named Discount in the form that's in the subform
control.
The reference:
Forms![Orders]![OrdersSubformControl]![Discount].Visible
is technically not correct, but Access is sometimes forgiving and figures
out what you mean (which actually makes it harder to learn in my view).

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Here is an exerpt from Microsofts Access Help...

To refer to a subform or subreport property, you must type
a full identifier for the form or report by using the Form
or Report property of a subform or subreport control. For
example, the following identifier refers to the Visible
property of the Orders Subform subform:

Forms![Orders]![OrdersSubformControl].Form.Visible

********************************************************
On my computer, the above statement blows up, but if you
have....
Forms![Orders]![OrdersSubformControl].Visible
it works.

The help goes on to state...
********************************************************

In contrast, to refer to a control on a subform or
subreport, or one of the control's properties, you don't
have to use the Form or Report property. For example, the
following identifier refers to the Visible property of the
Discount control on the Orders Subform subform:

Forms![Orders]![OrdersSubformControl]![Discount].Visible

********************************************************
On my computer, this statement blows up, but if you have....
Forms![Orders]![OrdersSubformControl].Form![Discount].Visible
it works.
********************************************************

Am I going crazy here or am I just missing something?
Micrsoft has been stating this for a long time... For at
least 11 years now (Since I started developing Access
Datatbases) Obviously I've ignored the help and did what
worked. Just thought I'd post this and see what other
people say...


.
 
Back
Top