subform reference

J

JD

I use the following reference on a subform and it works fine when I pull the
subform up on it's own but when I pull up the main form and access the field
in the subform, it pops up with a field indicator like it doesn't know what
is going on:

[forms].[Electronic ACM Subform].[CyberAssetID]

Please help
 
K

Klatuu

When addressing a subform's controls, you do not use the name of the form
being used as the subform. You use the name of the subform control on the
main form followed by Form, which is what refers to the subform control's
Source Object property. The correct syntax is:

Me.SubformControlName.Form.ControlName
The same is true for using methods and properties. For example if you want
to requery the subform (a method) it would be:
Me.SubformControlName.Form.Requery
 
D

Douglas J. Steele

Just to complete Dave's comment, if you're trying to refer to a control on a
subform from somewhere other than on the parent form, you'd use

Forms!ParentFormName!SubformControlName.Form.ControlName

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


Klatuu said:
When addressing a subform's controls, you do not use the name of the form
being used as the subform. You use the name of the subform control on the
main form followed by Form, which is what refers to the subform control's
Source Object property. The correct syntax is:

Me.SubformControlName.Form.ControlName
The same is true for using methods and properties. For example if you
want
to requery the subform (a method) it would be:
Me.SubformControlName.Form.Requery
--
Dave Hargis, Microsoft Access MVP


JD said:
I use the following reference on a subform and it works fine when I pull
the
subform up on it's own but when I pull up the main form and access the
field
in the subform, it pops up with a field indicator like it doesn't know
what
is going on:

[forms].[Electronic ACM Subform].[CyberAssetID]

Please help
 
J

JD

Klatuu and Douglas,

Thank you so much for your assistance. The syntax that you both provided
solved my issue.

John A. Davis

Douglas J. Steele said:
Just to complete Dave's comment, if you're trying to refer to a control on a
subform from somewhere other than on the parent form, you'd use

Forms!ParentFormName!SubformControlName.Form.ControlName

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


Klatuu said:
When addressing a subform's controls, you do not use the name of the form
being used as the subform. You use the name of the subform control on the
main form followed by Form, which is what refers to the subform control's
Source Object property. The correct syntax is:

Me.SubformControlName.Form.ControlName
The same is true for using methods and properties. For example if you
want
to requery the subform (a method) it would be:
Me.SubformControlName.Form.Requery
--
Dave Hargis, Microsoft Access MVP


JD said:
I use the following reference on a subform and it works fine when I pull
the
subform up on it's own but when I pull up the main form and access the
field
in the subform, it pops up with a field indicator like it doesn't know
what
is going on:

[forms].[Electronic ACM Subform].[CyberAssetID]

Please help
 

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