T
toga
Hello, I am trying to learn about using visual basic for
accrss. I have created a form with 2 lables and 2 text
boxes on it (the names given to the lables and text boxes
is 1, 2, 3 and 4). On the click of a button I wanted to
set their properties ".Visible" to false.
This works fine if I used a seperate line of VB as below,
where the box [ ] would contain the corresponding number
e.g. [1] or [2] etc.:
Forms![EmployeesLogin]![1].Visible = False
However, I then tried to use a "For Loop" to loop through
and set the properties to false, without success e.g.
Dim F As String
Dim i As Integer
For i = 1 To 4
F = "Forms![EmployeesLogin]!["
F = F & i & "].Visible = False"
MsgBox F
Next
The code places the correct corresponding number in the
[ ] but doesn't execute. Any ideas please?
Many thanks
accrss. I have created a form with 2 lables and 2 text
boxes on it (the names given to the lables and text boxes
is 1, 2, 3 and 4). On the click of a button I wanted to
set their properties ".Visible" to false.
This works fine if I used a seperate line of VB as below,
where the box [ ] would contain the corresponding number
e.g. [1] or [2] etc.:
Forms![EmployeesLogin]![1].Visible = False
However, I then tried to use a "For Loop" to loop through
and set the properties to false, without success e.g.
Dim F As String
Dim i As Integer
For i = 1 To 4
F = "Forms![EmployeesLogin]!["
F = F & i & "].Visible = False"
MsgBox F
Next
The code places the correct corresponding number in the
[ ] but doesn't execute. Any ideas please?
Many thanks