Reset/Clear Form Command Button

G

Guest

Hello

I'd like to place a button my my form that will clear all data entered into
fields on my form. I've tried using the command button wizard: form options:
refresh form data, but that's not really what i need.

any ideas?

thanks!
/amelia
 
D

Daveo

Hi there,

Try the following in the On Click event of a button on your form:

Private Sub cmdYourCmdButton_Click()

[YourField1].Value = ""
[YourField2].Value = ""
[YourField3].Value = ""
[YourField4].Value = ""
....and so on...

End Sub

David
 
G

Guest

Thank you, Daveo.

I should have been more explicit: I'm hoping to do this with a macro.

/aae
 
G

Guest

I figured it out:

SetValue
Item: [Forms]![MyForm]![MyElement]
Expression: Null

you did point me in the right direction. thanks!

/aae
 
G

Guest

hrm - however, it doesnt actually "reset" the form. simply changes the fields
to null. this does not solve my issue.

i need a button that will, via macro, clear/reset/refresh my form as if no
data were ever selected/entered.


/aae
 
P

PC Datasheet

To clear the form before the data in the form is saved, put the following
code in the click event of your button:
Me.Undo
Undo will not work if the data has already been saved!!
 
R

Rick Brandt

aaearhart said:
Hello

I'd like to place a button my my form that will clear all data
entered into fields on my form. I've tried using the command button
wizard: form options: refresh form data, but that's not really what i
need.

any ideas?

Is this a bound form? If so are you talking about cancelling a record that
was entered, but not yet saved or do you want to delete a record? Do you
just want to move to the new record position so you can enter another
record? "Clear all data" could be interpetted many ways and you're going to
have to clarify what you want.
 
G

Guest

access seems to bug out and get confused by the "Me" part of Me.Undo. it says
it's looking for a macro called "Me."
 
G

Guest

right now, i have a cheat macro that simply closes and re-opens the form when
the "Reset" button is clicked. This definately works, but there must be
something more appropriate.

/aae
 

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

Top