CMD Question

  • Thread starter Thread starter James
  • Start date Start date
J

James

Hello How do I get a CMD Button to clear a page... so for
arguments sake I have three cbo boxes and two text
boxes... How can I have a button which clears them all
like it was adding a record?

Many Thanks

James
 
Two methods of doing this: -

1. This method adds a new record: -

DoCmd.GoToRecord , , acNew

2. This method clears the content of the Controls: -

Me.TextControl1 = ""
Me.TextControl2 = ""
Me.ComboControl1 = ""
Me.ComboControl2 = ""
Me.ComboControl3 = ""

HTH

Tony C
 
You may not be getting exactly what you want with #2! If you go to a different
record (new or existing) or close the form, you will have a record in the base
table where all the fields are blank. In #1, you save the record when you go to
a new record so whatever was in the fields at the time are saved as a record in
the table.

To get what you probably want, consider the following:
1. If the record has not been saved yet, execute the following:
Me.Undo

2. If the record has been saved, execute the following:
DoCmd.Runcommand acDeleteRecord
 
Back
Top