VBA equivalent of F9 or shift+enter?

M

mikelee101

Hello,
I have very limited experience with Access VB, so this is probably a very
easy question. I just can't seem to find anything in Help.

I have a button on a form that runs a query. However, the query will fail
unless the active record in the form is saved first. Rather than try to
explain to users that they have to hit shift+enter before clicking the
button, I want a line of code that will do it for them. I suspect that it
will have something to do with the CurrentRecord property, but I've had no
luck with the following:

CurrentRecord.Save
Me.CurrentRecord.Save
DoCmd.Save(acForm,CurrentRecord)
DoCmd.Save(acForm,Me.CurrentRecord)
DoCmd.Save

If anyone can let me know if I'm on the right track, I'd really appreciate
it. I don't have any sort of reference other than Access Help. Access 2000,
XPPro SP2.

Thanks a million.
 
K

Ken Snell \(MVP\)

Assuming that you want to save the data in the form that is running the
code, this is the most common way to do that:

Me.Dirty = False
 
M

mikelee101

Ken,
That did the trick. Thanks for the help.

--
Mike Lee
McKinney,TX USA


Ken Snell (MVP) said:
Assuming that you want to save the data in the form that is running the
code, this is the most common way to do that:

Me.Dirty = False
 
Top