Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error 2046, The Command or Action 'SaveRecord' isn't available now. 2

Status
Not open for further replies.

WhiskyMac

MIS
Feb 24, 2003
7
GB
I'm using Access 2002 and want to force a record to be saved prior to printing. The VBA command line I'm using is

DoCmd.RunCommand acCmdSave

but this returns the error message
"Error 2046, The Command or Action 'SaveRecord' isn't available now."

Anyone got a work around?
 
You'll get an email notification when someone replies.

The SaveRecord function must have the ACTIVE WINDOW set properly. Usually you have the active window set right, but if you somehow open a report, or switch focus to another form, or do something crazy in code (like call the saverecord from Form_BeforeUpdate() ). There are lots of reasons why this won't work. Do a

DoCmd.SelectObject acForm, "yourFormName"

immediately before the saverecord, and see if this clears the problem up.

Oh yeah, and this will ABSOLUTELY NOT WORK in debug mode. If you're stepping through this code, start stepping immediately AFTER that line. After all, if you're stepping through code, then the active window is the VB Editor...you see the problem.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top