Microsoft
Software
Hardware
Network
Question : Use Variable to address a control
I have two subforms, each with a command button called "cmdAddNewRecord". I refer to these form the main form. Rather than having the same code to refer to each, I want to declare the form name as a vaiable and use the variable in the code
The code is:
Me.frmProfile.Form!cmdAddN
ewRecord.V
isible = True
What I would like to is:
dim FormName as string
FormName = "frmProfile"
and then change the code to:
FormName.Form!cmdAddNewRec
ord.Visibl
e = True
But Access does not like this!
What is the correct syntax?
Answer : Use Variable to address a control
You would do it like this:
Forms(FormName).Form.cmdAd
dNewRecord
.Visible = True
Note that you refer to a "main" form differently than you do a Subform.
Random Solutions
Access 2007 VBA Report onFormat ignored on open
Use the Tab-Key in an Edit Box.
HELP!!! email a .snp report....
Is there a way of identifying when a field is used and in which queries
Access 2007 - Data Entry Property is not working within a subform.
VBA Help Doesn't Work
Login scripts not working between domains with a trust
User Profile Service error when logging in. Regedit BAK stuff not applicable.
Can't Open Reports
Insufficient system resources exist t complete the requested service