Syntax HELP

  • Thread starter Thread starter NEWER USER
  • Start date Start date
N

NEWER USER

I need some help verifying the correct syntax when referencing a subform on a
main form. Some examples I have are:
Forms!frmProduct!fsubRelations!GPM.ColumnHidden = -1
Forms!frmProduct!fsubRelations!Cost.Requery
"Number = Forms!frmProduct!fsubRelations!Number"

OR should I be writing?

Forms.frmProduct.fsubRelations.Form.GPM.ColumnHidden = -1
Forms.frmProduct.fsubRelations.Form.Cost.Requery
"Number = Forms.frmProduct.fsubRelations.Form.Number"

Any help appreciated.
 
I need some help verifying the correct syntax when referencing a subform on a
main form. Some examples I have are:
Forms!frmProduct!fsubRelations!GPM.ColumnHidden = -1
Forms!frmProduct!fsubRelations!Cost.Requery
"Number = Forms!frmProduct!fsubRelations!Number"

OR should I be writing?

Forms.frmProduct.fsubRelations.Form.GPM.ColumnHidden = -1
Forms.frmProduct.fsubRelations.Form.Cost.Requery
"Number = Forms.frmProduct.fsubRelations.Form.Number"

Any help appreciated.

Access is smart enough to disentangle some of these, but the proper syntax is

Forms!NameOfMainform!NameOfSubform.Form!NameOfControl

For an action, use

Forms!NameOfMainform!NameOfSubform.Form.Requery

or whatever form action you wish to do.

NameOfSubform is the Name property *of the Subform control*, the box
containing the subform object; this might or might not be the same as the name
of the form within the subform box.

If the code is on the main form, you can use Me! as a shortcut for
Forms!NameOfMainform.

The word Number is a reserved word and a bad choice for either a variable or a
control name.

John W. Vinson [MVP]
 
Back
Top