Referencing forms from other forms ? (1 Viewer)

liamfitz

Registered User.
Local time
Today, 16:23
Joined
May 17, 2012
Messages
240
This link in FAQ http://access.mvps.org/access/forms/frm0031.htm , suggests the following format, to reference a mainform's control's property from another form ...
Code:
Forms!Mainform!Controlname.property

However I continually get, " Cannot find the referenced form (formname )". I've tried several Mainforms, and the spelling/case of letters, is definitely correct. Could it be the syntax ?
:confused:
 

Trevor G

Registered User.
Local time
Today, 16:23
Joined
Oct 1, 2009
Messages
2,341
Do you have spaces in your form name, if so you may need to use square brackets
 

mdlueck

Sr. Application Developer
Local time
Today, 11:23
Joined
Jun 23, 2011
Messages
2,631
I found this page most helpful when becoming comfortable with referring to controls on forms.

http://access.mvps.org/access/forms/frm0031.htm

I prefer not to use the ! deliminator syntax, and instead use function () type syntax:

Code:
    'Refresh the prior window UI
    Call Forms("adminauth").Refresh_Click(intAuthID)
So, this LOC reaches into the Forms collection and looks for a form named "adminauth", once found it sends that form the Refresh_Click event a message to be run, passing it one arg intAuthID.
 

Shallo9

Registered User.
Local time
Today, 08:23
Joined
Nov 11, 2011
Messages
95
Greetings

Please provide the name of the form and then the name of the control and the property you'd like to change?
 

liamfitz

Registered User.
Local time
Today, 16:23
Joined
May 17, 2012
Messages
240
My command line is ...

Code:
Forms!frmAfAIS(test)!lblTest.Caption

I take the point about 'miscellaneous' characters - maybe the brackets are an issue. I'll ltry the SQUARE Brackets technique. Thank you.
:eek:
 

mdlueck

Sr. Application Developer
Local time
Today, 11:23
Joined
Jun 23, 2011
Messages
2,631
I take the point about 'miscellaneous' characters

I would suggest only letters a-z, numbers 0-9, and underscore _ characters to achieve the best compatibility.
 

liamfitz

Registered User.
Local time
Today, 16:23
Joined
May 17, 2012
Messages
240
I've changed the form's name, and now it works ( no special characters ! ) Thank you.
 

Users who are viewing this thread

Top Bottom