Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Clear Form Button 3

Status
Not open for further replies.

buee04

Technical User
Jun 27, 2002
129
US
Hi,

Can someone show me how to add a "Clear Form" button to a form? I have very minimal experience with vba so please can you explain step by step.

Thanks in advance.
 
It sounds like you and I are doing the same thing. Here is what I did to create a clear form button. I was lazy and used the code already built into Access for this button.

1. Create a command button.
2. In the options for this button (in the wizard) choose Record Navigation
3. Then choose Undo Record
4. Name the command Clear Form or whatever you wish.

Hope that helps!
Sarah

 
Hia,

If you only want particular fields cleared from a record (without clearing the whole record) you can do this too.

Lets say you have three fields on your form:

txtFirstName
txtSurName
txtLocation

Now lets say all three have something in them, but you only want to delete the firstname and surname (leaving the location in.

Create a command button with an OnClick event and type the following code:

Code:
txtFirstName = ""
txtSurname = ""

HTH's
 
WOW, I love this community! I got 2 responses each with a different method within 10 minutes.

I didn't know that the Undo Record Button was basically clearing the form...that makes everything so easy now.

And I like Simon's way too, I think I'll use that method later in the database.

Thank you very much!!

Jon
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top