I have a method in a bas module:
**********************************************
Public Sub clearForm(theForm As Form)
Dim ctlC As Control
For Each ctlC In theForm.Controls
If TypeOf ctlC Is TextBox Then ctlC.Text = ""
If TypeOf ctlC Is ComboBox Then ctlC.Clear
If TypeOf ctlC Is CheckBox Then ctlC.Value = 0
If TypeOf ctlC Is OptionButton Then ctlC.Value = False
Next
End Sub
**********************************************
from a form, i tried to call this method by
**********************************************
Private Sub mnuFileNew_Click()
Dim result as Integer
result = MsgBox "Clear?"
If result = vbYes Then clearForm (Me)
End Sub
**********************************************
when i try to run, the program gives me a "type mismatch" error.
can someone tell me what is wrong?
Thanks a million!
**********************************************
Public Sub clearForm(theForm As Form)
Dim ctlC As Control
For Each ctlC In theForm.Controls
If TypeOf ctlC Is TextBox Then ctlC.Text = ""
If TypeOf ctlC Is ComboBox Then ctlC.Clear
If TypeOf ctlC Is CheckBox Then ctlC.Value = 0
If TypeOf ctlC Is OptionButton Then ctlC.Value = False
Next
End Sub
**********************************************
from a form, i tried to call this method by
**********************************************
Private Sub mnuFileNew_Click()
Dim result as Integer
result = MsgBox "Clear?"
If result = vbYes Then clearForm (Me)
End Sub
**********************************************
when i try to run, the program gives me a "type mismatch" error.
can someone tell me what is wrong?
Thanks a million!