Help! How does one clear a form with code?

N

Nancy

I would like to create a button to clear the entire form (there is only 1
screen).

Thanks,
 
C

Cheese_whiz

Well, how about this:

Your_Button_Click()

DoCmd.Close
DoCmd.OpenForm "Your form name"

End Sub
 
B

babyatx13 via AccessMonster.com

Nancy said:
I would like to create a button to clear the entire form (there is only 1
screen).

Thanks,
When filling out a form, Access adds records to a table, do you want to save
the record and “clear†the form (use Add Record) or do you want to “clearâ€
the form without saving?(use Delete Record) just change caption to read Clear
Form.

Note: If you are using an auto number field for your key field each time you
delete a record it will default to the next number.

Otherwise for each field name in VBA

Private Sub Clear_Click()

FieldName.Value = Null
FieldName1.Value = Null
FieldName2.Value = Null

End Sub

K Board
 
N

Nancy

I tried this before I posted this question. The problem is, the data (from
adding as well as querying) still remains on the form. It there another way
to clear the data on the form.
 
Top