Clear button on a form

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I wish to have a clear button on my form that when pushed it would clear the
contents of a box where information was typed in. Is there a way (without
programming) to do this?

Thank you!
 
Hi

Without programming - not really. Programming is simply a method (some
simple or some complex) of telling your application what you want to happen
in certain circumstances - as an example pressing a button, entering data,
moveing away from a control, etc etc etc - there are LOTS of events that you
may want something to happen during after before etc etc. So a little
"Programming" is a good thing to learn.

Open your form in design view and ensure the Toolbox is shown.
Click the Command Button icon
Click somewhere on your form and a new button will appear.
The command button wizard will appear - click cancel and close the wizard
Right click your new button and select Properties
Select the "Other" column and in the Name row give the button a name that
means something to you (like "FieldClear")
On the events column select OnClick and select the build option (...)
Select Code
You will see this


Private Sub FieldClear_Click()

End Sub

You need to do some "Programming" here and tell the application what you
want to happen when you click the new button.
Basically you want a field to clear (become Null)

So add the code
Me.FieldName = Null
between the 2 lines of code that are already there so it looks like this

Private Sub FieldClear_Click()
Me.FieldName = Null
End Sub

Change the fieldName above to the real name of the control you want to clear.

Click save and view the form your will see it works

Have fun
 
"I wish to have a clear button on my form that when pushed it would clear the
contents of a box where information was typed in."

To what end? Has data been entered for a new record that you wish to clear.
Do you wish to go to a new record and enter data? Are you talking about
clearing data from a single text box on the form or from all text boxes? A
little more info is needed for us to really help you.

--
There's ALWAYS more than one way to skin a cat!

Answers/posts based on Access 2000

Message posted via AccessMonster.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top