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 databse already in use
I need to strip out every vbCrLF from a field
Microsoft, Office, 2007, Change User Menus & interfaces to English
How can I substract todays dates from the initial date?
How Can I Create a Unique Sequential Number for Only Those Records in a Table That Meet a Criteria
Access Report to PDF without Save As Dialog
file mountmgr.sys caused an unexpected error 256 at line 5964
Can't run eseutil on Exchange 2k3 server
Preventing Outlook Calendar Conflicts
Change default editor in Outlook 2010 Beta.