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
Domain controller for Group Policy operations is not available. and a couple other things.
Design question on being able to select multiple records on the form
vba code to show a message when no records exist when a form is opened
Access 2007 RunTime - "The command or action 'Find' isn't available now."
creating system.mdw whit VB 5
WSUS on Windows 2003 R2 Standard, Does the Report Viewer 2008 Work on this.
csv delimeter problem when importing to adp
How do I restore the toolbar at the bottom of Outlook Mailbox where the number that shows the number of email messages is located.
Using web service in javascript for asp.net ajax-enabled web site
Pre-Filled Acrobat forms with data from Access