Easy way to clear unbound form? (1 Viewer)

brucesilvers

Registered User.
Local time
Today, 15:51
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
 

KevinM

Registered User.
Local time
Today, 23:51
Joined
Jun 15, 2000
Messages
719
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
 

brucesilvers

Registered User.
Local time
Today, 15:51
Joined
Aug 4, 2000
Messages
70
Thanks
I'll give that a try.
 

brucesilvers

Registered User.
Local time
Today, 15:51
Joined
Aug 4, 2000
Messages
70
Just wanted to let you know that your code worked perfectly. Thanks Kevin
 

Users who are viewing this thread

Top Bottom