Clear (1 Viewer)

Mik3

Registered User.
Local time
Today, 09:11
Joined
Jul 10, 2003
Messages
60
Is there a command or something that would clear all entries in a form (as if the user has pressed Esc)?
 

IMO

Now Known as ___
Local time
Today, 09:11
Joined
Sep 11, 2002
Messages
723
Put this code in the Click event of a button
Code:
DoCmd.RunCommand acCmdUndo

IMO
 

Mik3

Registered User.
Local time
Today, 09:11
Joined
Jul 10, 2003
Messages
60
Couldn't make that work.
I need to put it inside a macro to clear all items in a form before closing.

Do asteroids orbit planets? :)
 

IMO

Now Known as ___
Local time
Today, 09:11
Joined
Sep 11, 2002
Messages
723
Why would you need to clear all fields before closing? Don't you want to store the data after input?

IMO

My asteroid does :cool:
 

Mik3

Registered User.
Local time
Today, 09:11
Joined
Jul 10, 2003
Messages
60
it works like this..
users fills the form and clicks the button.
a new form opens, which writes values to a table, and closes.
now i want to close the original form as well (or go to a new record), however, since the form is not empty, a new record is being created in the table - and i do not want this. i thought that if i cleared the form before closing it or going to a new record i might solve the problem.
 

IMO

Now Known as ___
Local time
Today, 09:11
Joined
Sep 11, 2002
Messages
723
The code to add a new record is...
Code:
    DoCmd.GoToRecord , , acNewRec
To close the current form...
Code:
   DoCmd.Close
To close another form that is open...
Code:
    DoCmd.Close acForm, "NameOfOtherForm"
IMO
 

Users who are viewing this thread

Top Bottom