I want to know if it is possible to use a string variable to reference a form object name.
Capture.PNG
I have 9 check boxes and 9 text boxes, and I only want each text box to be enabled if the subsequent check box is checked.
The check boxes are named Dur1, Dur2, ... , Dur9. The text boxes are named Setup1, Setup2, ... , Setup9.
I want to do something like this, but can't figure out how:
Dim i As Integer
Dim DurStr As String
Dim SetupStr As String
For i = 1 To 9
DurStr = "Dur" + str(i)
SetupStr = "Setup" + str(i)
If DurStr.Value = True Then SetupStr.Enabled = True
ElseIf DurStr.Value = False Then SetupStr.Enabled = False
EndIf
Next
This code obviously doesn't work.. Is there a way that I can do this?
Bookmarks