Naming Forms In The Code

R

rudwan

hi
if i want to refere to a control in the code , it will be
like this
=forms![formname]![controlName]
but if the form name consist of 2 words separated like
this :
=forms![orders subform]![controlName]
it not accept it , who i can refere to it ?
also i faile to refere to the form name in another use like
forms![orders subform].setfocus
 
B

Bruce M. Thompson

if i want to refere to a control in the code , it will be
like this
=forms![formname]![controlName]
but if the form name consist of 2 words separated like
this :
=forms![orders subform]![controlName]
it not accept it , who i can refere to it ?
also i faile to refere to the form name in another use like
forms![orders subform].setfocus

If you are trying to reference a subform contained within an open form, you must
use the following syntax:

Forms!MainFormName!SubformControlName.Form

And if referencing a control on that same subform:

Forms!MainFormName!SubformControlName.Form!ControlName

You would need to replace "MainFormName" with the name of the main form,
"SubformControlName" with the name of the subform *control* on the main form
(not the name of the subform, although both may share the same name) and
"ControlName" with the name of the control on the subform. The space in an
object name shouldn't make any difference as long as you enclose the name in
brackets ([]), as you have in your given example.
 
R

Roger Carlson

On my website (see sig below) is a small sample database called
"SubformReference.mdb" which illustrates how to solve a number of problems
involved with referencing subforms and subsubforms.
 
R

rudwan

i dont know how to thank u about this great help
i wish to be ur student
-----Original Message-----
On my website (see sig below) is a small sample database called
"SubformReference.mdb" which illustrates how to solve a number of problems
involved with referencing subforms and subsubforms.

--
--Roger Carlson
www.rogersaccesslibrary.com
Reply to: Roger dot Carlson at Spectrum-Health dot Org

hi
if i want to refere to a control in the code , it will be
like this
=forms![formname]![controlName]
but if the form name consist of 2 words separated like
this :
=forms![orders subform]![controlName]
it not accept it , who i can refere to it ?
also i faile to refere to the form name in another use like
forms![orders subform].setfocus


.
 
P

PC Datasheet

=forms![orders subform]![controlName]
This is correct! The square brackets are required when there is a space in an
onject's name. Perhaps you have a paranetheses or brace (}) or ({) insted of a
square bracket.

In the other oart of your question, Orders Subform must be the name of the
subform control and not the subform iself!
 

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