Command button to save record and generate new form

  • Thread starter Thread starter Momof2
  • Start date Start date
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?
 
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."
 
Back
Top