VB Code using variables for Forms controls
Formnname = "test_form"
FieldName = "command0"
Propertyname = "Visible"
Forms(Formname).Form(FieldName).Propertyname = False
Can not seem to figure out if you can put the property name as a variable like the form name and fieldname.
Thank you for taking the time to report an issue.
What's wrong... Please write below.
How can it be done ?
I tried to use this piece of code:
Dim frmObj As AccessObject Dim ctl as Control
For Each frmObj In Application.CurrentProject.AllForms
DoCmd.OpenForm frmObj.name, acDesign
This work but I can't find the way to go through controls as what I get is AccessObject and not a Form object, and can't use this part of the code:
For Each ctl In frmObj.name
I created some Module classes and many functions which are used by the forms in the database. The user will be able to make some selections in listboxes, checkboxes and other controls and then generate an Excel file with the filtered data.
My question is whether the values of the global variables and classes used by the form will be affected when a second, third or nth user opens the database at the same time and makes his own selections. So in short: will Access create a new set of global variables for each user and make those variables only accessible within the session of that user?
I might be able to test this in a week, but I need to advance with my coding now. Any insight regarding forms with multiple sessions is
When working with Data Access Objects (DAO) or ActiveX Data Objects (ADO), you may need to construct an SQL statement in code. This is sometimes referred to as taking your SQL code "inline."
2. Can I hide active controls command button depending on forms control check box. (If its turn on I can see buttons, else I can't.) and if I can how?
Private Sub Command220_Click()
On Error GoTo Err_Command220_Click
If Me.Form("00 upc creatED").Controls("group 2").Value = 3 Then
MsgBox ("Already created! Try Again.")
DoCmd.OpenForm "00 upc create", , , ""
Forms("00 upc create").Controls("dvd release").Value = Me.[DVDID]
Forms("00 upc create").Controls("group 1").Value = 1
Forms("00 upc create").Controls("GROUP 2").Value = 3
Forms("00 upc create").Controls("PRICE").Value = Me.Text229
Form and report design consists of populating them with the necessary controls that would allow a person to use your database. To perform this design, you first open the form or report in Design View.
Topics: Control Design, Common Properties of Controls, Tables Columns and Windows Controls, Common Methods of Windows Controls, Common Events of Windows Controls, Windows Controls: The Label, Windows Controls: The Group Box, Windows Controls: The Text Box, Windows Controls: The Month Calendar, Windows Controls: The Date Picker, Windows Controls: The Time Picker, Windows Controls: The Command Button, Combo and List Boxes, Check Boxes and Toggle Buttons.
When I click OK they disappear. they are there according to properties, although I can't see them because the form will not display while in debug mode.
When the program finishes, the controls that were created are gone. Too bad there isn't any documentation (or any than can be found) that describes how to do this.
Here is the code to create a form and controls (it works):
Then I try to add controls to the form with this (they disappear):