I would like to call a public procedure to do some modifications in multiple forms.
The name of the forms are the same, but followed by a number. The name of the form and the number I'd like to put in a variable for the procedure to work with. I just don't know how to make the variable so VBA would accept it?
If the variable could work, then I would be able to use the same procedure to do mods in form_Test_0, form_Test_1, form_Test_2 etc...
Public Sub paintForm(Optional FormIdent = 0)
Dim varForm
'form_Test_0 is the name of the form listed in VBAs Microsoft Access Class objects
varForm = "form_Test_" & FormIdent 'Will NOT be approved
varForm = "form_Test_0" 'Works!
With varForm
.Controls("something").Property = Value
.Controls("somethingelse").Property = Value
End With
End Sub
The name of the forms are the same, but followed by a number. The name of the form and the number I'd like to put in a variable for the procedure to work with. I just don't know how to make the variable so VBA would accept it?
If the variable could work, then I would be able to use the same procedure to do mods in form_Test_0, form_Test_1, form_Test_2 etc...
Public Sub paintForm(Optional FormIdent = 0)
Dim varForm
'form_Test_0 is the name of the form listed in VBAs Microsoft Access Class objects
varForm = "form_Test_" & FormIdent 'Will NOT be approved
varForm = "form_Test_0" 'Works!
With varForm
.Controls("something").Property = Value
.Controls("somethingelse").Property = Value
End With
End Sub