save record button easier way?

D

Dean Hastas

Using Access 2003 Whats the easiest way to save a record after edit and
after insert behind a save commnad button. For example query1.posts ect

ect. Below is what the command button generates
but must be a cleaner way?
Thaks for any help

Private Sub Command59_Click()
On Error GoTo Err_Command59_Click
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70

Exit_Command59_Click:
Exit Sub

Err_Command59_Click:
MsgBox Err.DESCRIPTION
Resume Exit_Command59_Click

End Sub
 
B

Beetle

Well, that's only one line of code (not including the error handling) so
I'm not sure what you mean by a *cleaner* way. I suppose you could
replace it with;

Private Sub Command59_Click()
On Error GoTo Err_Command59_Click

DoCmd.RunCommand (acCmdSaveRecord)

Exit_Command59_Click:
Exit Sub

Err_Command59_Click:
MsgBox Err.DESCRIPTION
Resume Exit_Command59_Click

End Sub

BTW - you may want to consider giving your controls more meaningful names.
As time goes on and your db grows, having your code full of references like
Command59 and Text23, etc. will make it difficult to know what's what.
 
C

Clif McIrvin

Douglas J. Steele said:
If Me.Dirty Then Me.Dirty = False


Is that documented somewhere? It doesn't seem to be in the installed
help files for Access 2003.
 

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