Easy way to clear unbound form?

brucesilvers

Registered User.
Local time
Today, 10:11
Joined
Aug 4, 2000
Messages
70
I have a "New Member" form that is not bound to a table, but is the basis of an append query that adds records to a table (set up this way to enable various combo boxes which are filtered by queries). Is there a simple way, other than closing and reopening, to clear all fields on the form? Thanks
smile.gif
 
Put a command button on your form and on the OnClick event put....

Dim frm As Form
Dim ctl As Control
Set frm = Me

'Loop through all text boxes and
'Comboboxes on form and set valie to nothing
For Each ctl In frm.Controls
f ctl.ControlType = acTextBox _
Or ctl.ControlType = acComboBox Then
ctl.Value =""
End If
Next ctl
End Sub

HTH
 
Thanks
smile.gif
I'll give that a try.
 
Just wanted to let you know that your code worked perfectly. Thanks Kevin
smile.gif
 

Users who are viewing this thread

Back
Top Bottom