Update record before doing other code

G

Guest

Hello,

I have some code to do and action when the user clicks a button. However,
what code can I use to save any changes that the user may have made on the
current record before executing my code?

I was looking at using an if me.dirty then but do not know how to save the
current record?

Thanks,

Daniel
 
A

Allen Browne

The form's Dirty property will be true if there are unsaved edits in
progress. You can force the save by setting Dirty to false.

So:
If Me.Dirty Then Me.Dirty = False

If you prefer:
RunCommand acCmdSaveRecord
Access applies that to whatever form has the focus, but if you just clicked
the button there's a pretty good chance the right form has focus.
 
G

Guest

Allen,

Thank you so very much. So simple (here I was trying to mess around with
rst.update ....)!

Can't count the number of time you or your website have saved my .....

Daniel
 

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