Link to home
Start Free TrialLog in
Avatar of Jagwarman

asked on

access 2010 error the command or action save record isnt available now

Would an Expert be able to throw any light on this er

the command or action save record isn't available now

Avatar of Gustav Brock
Gustav Brock
Flag of Denmark image

You are most likely about trying to save a record while you still are editing it.

Avatar of Jagwarman


Hi Gustav, I don't think so. I had everyone close their Access down. I then went into the record and got the error.
You didn't tell much so I thought it was a coding question.
Still, something is locking the table.

Copy the backend to a local folder, relink to this. If the error is gone, you may face a network issue.

Unfortunately I am not an Access Expert so I don't know how to do what you suggested :-(
If everyone is sharing the same file on the server, copy that file to a local folder and run it from there.

If that works, study the on-line help on the wizard that splits a database into two, a backend on the server and a frontend with everything else, located on the workstations.

When you get the message, press cntl-break to stop the code.  Post the procedure (including the header).
did that Gustav but I get the same error.

When I go into tables I can see the record has changed from closed to open having been amended despite the error saying it has not been saved
So it is a coding issue. Follow the advice from Pat.

do you mean this

Private Sub acMainOpenClosedStatus_AfterUpdate()
DoCmd.DoMenuItem acFormBar, acFile, acSaveRecord
End Sub

or this

Run-time error '20-46';

The command or action 'SaveRecord' isn't available now.
If acMainOpenClosedStatus is your form, you have just updated this.
Then there is nothing to save, thus the error.

Can't you just remove the DoCmd. .. command?

Avatar of PatHartman
Flag of United States of America image

Link to home
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
The times that I most commonly run into that error is when I have code like
DoCmd.DoMenuItem acFormBar, acFile, acSaveRecord
and I have breakpoints on as I am stepping through the code.
The command then tries to execute when the code windows is the focus, and things go BANG!

Now, that clearly isn't what your problem is, but the idea is related.
Whenever the SaveRecord command would be greyed out on the toolbar\Ribbon, if your code issues that command, it'll go BANG! (in my case, trying to save the record when the code window is the active object makes no sense and I get a BANG!)

Now, even though the button wizards still (Still!) create that kind of code, it's old-school Access 97 compatible.
These days, the syntax should be
DoCmd.RunCommand acCmdSaveRecord

That still won't help if the command would be greyed out by circumstances.
What the code is trying to tell you is that all the prerequisites for saving a record aren't present yet.
What type of control is acMainOpenClosedStatus and what other controls must have values in them before you can save a record?  Are there ALWAYS a set of circumstance where you can get the error to occur?
Looks like mine is one of those rare cases. Thanks.