Hi!
One word of warning about the code above there are some types of controls that do not have a value property, such as labels, and will cause the this code to crash. One way around it is to check the control type like this:
clear_form(me)
Function clear_form(f As Form)
Dim c As Control
Dim f As Form
For Each c In f.Controls
If c.ControlType <> acLabel then
c.Value = 0
End If
Next
End Function
Or you can add an error check:
clear_form(me)
Function clear_form(f As Form)
Dim c As Control
Dim f As Form
On Error GoTo ErrCheck
For Each c In f.Controls
c.Value = 0
Next
Exit Sub
ErrCheck
If Err.Number = ? (you will need to find the correct number) Then
Continue
End If
End Function
hth
Jeff Bridgham
bridgham@purdue.edu