Command button to save record and generate new form

M

Momof2

I have a form which is used for data entry. The form has a command button
which when clicked saves the record to a table. How would I set the command
button to not only save the record when clicked but to also re-generate the
same blank form or simply just clear all the fields?
 
A

Al Campagna

Momof2,
Your button just needs to move to a "New" record. Whenever you leave a
record, any data entries/changes are written to the table.
So... (use your own object names) the following should do what you want.

Private Sub cmdNewRecord_Click()
DoCmd.GoToRecord , , acNewRec
End Sub
Never do that in an attempt to create a new record. Just because the
fields are blank, does not make it a new record. Particularly when using
AutoNumbers or incrementing Primary keys.
Always go to a "New" Record.

--
hth
Al Campagna
Microsoft Access MVP
http://home.comcast.net/~cccsolutions/index.html

"Find a job that you love... and you'll never work a day in your life."
 
M

Momof2

Thank you very much! I figured it was something simple that I wouldn't think
of.
 

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