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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Clear a form 1

Status
Not open for further replies.

srodolff

Technical User
Aug 5, 2003
12
US
I have two questions.

1. How do I get a form to open with the fields blank?

2. What command can I add to a save record button to get it to clear the form after saving?

Thanks,
Steve
 
When you enter the values in a form, you are actually writing that data to the table under the form. What you then want is a new record in that same form.

The command, most easily written with the wiz, has a line of code that says:

DoCmd.GoToRecird,, ac New

That is the babe' that shows you a blank form with a new record.

That help???


Rollie E
 
1. i'm assuming you're opening the form from a button? in the button's OnClick event, add the Date Mode:

DoCmd.OpenForm stDocName, , , stLinkCriteria, acFormAdd

2. i'm assuming you mean "how can i make it make the form ready for entering a new record"?

Code:
    DoCmd.GoToRecord , , acNewRec
 
No go. When I add this command to the save button, I get a syntax error. I added this command immediately after the save record command.

BTW, I would also like to know how to return to the first record after the save record button is pressed.

I couldn't add the command when the form opens. I don't know where to specify it.

I hope that this isn't too confusing.

Thanks,
Steve
 
Ginger,
You are very helpful.

I need a little more help. The form will be opened when the database opens. Secondly, on the new record command, how do I get the first field to be selected again?

Thanks,
Steve
 
what was your syntax error? it's helps us help you if you include error messages and code here in your posts.

ok then--
1) this will make the form open ready to add a new record:
in the form design mode, if the PROPERTIES window is not already visible, choose from the menu VIEW+PROPERTIES.

in the DATA ENTRY property, set it to YES.

2) you are changing your story. in your first post you wanted the form to 'clear' after saving, then you say you want to go to the first record after saving, now you want to go the 'first field'. so many different requests....if what you mean is you want to go to a new blank record, with the cursor in the first field.....in the design of the form, right-click in the black square in the upper-left-hand corner of the form (in design mode). right-click and choose TAB ORDER. set the tab order as you wish. put the field you want first, first in the list. when the form goes to a NEW record, that's the field it will go in to.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top