The RunCommand works only if the from has focus.
Setting the Dirty property is better: you can specify the form, and it works
whether it has focus or not.
--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users -
http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.
"RC" <rc*********@yahoo.com> wrote in message
news:3c************************@posting.google.com ...
If I want to explicitly save the record before executing a Close
action. Which of the following should I use? Or does it depend on
whether it is based on a Form or something else?
If Me.Dirty Then
RunCommand acCmdSaveRecord
End If
DoCmd.Close
or
If Me.Dirty Then
Me.Dirty = False
End If