I am trying to use a module for the first time. This code, to clear all fields, works embedded in the form but not when I move it to the module. I changed Private to Public, but then I get an error message "improper use of Me". This makes sense since Me. is no longer the current form. I cannot figure out what to change it to. I tried [Forms]!Controls, but just a different error message.
I want to make this Sub available to other forms.
Thanks.
I want to make this Sub available to other forms.
Code:
Private Sub ClearCriteria()
Dim ctl As Control
For Each ctl In Me.Controls
Select Case ctl.ControlType
Case acTextBox, acComboBox, acListBox, acCheckBox
If ctl.ControlSource = "" Then
ctl.Value = Null
End If
Case Else
End Select
Next ctl
End Sub
Thanks.