Hi everyone,
I use the following code to clear controls on my forms.
**********
Sub ClearAll()
Dim ctl As Control
For Each ctl In Me.Controls
If ctl.Tag = "Clear" Then
ctl.Value = Null
End If
Next ctl
End Sub
****************
Easy enough and works great. I would like to put this code into a module or class module so I can call it from other forms without having to re-type the code on every form.
The problem comes form "Me.Controls". "Me" is limited to the name of the form the code is in. However, it wont work in a module (makes sense to me) since the module is outside a form and is generic. So,... how can I call the procedure from a module with the name of the form being a variable?
I hope my question makes sense. Thanks in advance.
Have A Great Day!!!,
Nathan
Senior Test Lead
I use the following code to clear controls on my forms.
**********
Sub ClearAll()
Dim ctl As Control
For Each ctl In Me.Controls
If ctl.Tag = "Clear" Then
ctl.Value = Null
End If
Next ctl
End Sub
****************
Easy enough and works great. I would like to put this code into a module or class module so I can call it from other forms without having to re-type the code on every form.
The problem comes form "Me.Controls". "Me" is limited to the name of the form the code is in. However, it wont work in a module (makes sense to me) since the module is outside a form and is generic. So,... how can I call the procedure from a module with the name of the form being a variable?
I hope my question makes sense. Thanks in advance.
Have A Great Day!!!,
Nathan
Senior Test Lead