Solved

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

Posted on 2014-11-25
13
392 Views
Last Modified: 2014-11-25
Would an Expert be able to throw any light on this er

the command or action save record isn't available now

thanks
0
Comment
Question by:Jagwarman
  • 5
  • 5
  • 2
  • +1
13 Comments
 
LVL 49

Expert Comment

by:Gustav Brock
ID: 40464645
You are most likely about trying to save a record while you still are editing it.

/gustav
0
 

Author Comment

by:Jagwarman
ID: 40464655
Hi Gustav, I don't think so. I had everyone close their Access down. I then went into the record and got the error.
0
 
LVL 49

Expert Comment

by:Gustav Brock
ID: 40464678
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.

/gustav
0
Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

 

Author Comment

by:Jagwarman
ID: 40464692
Unfortunately I am not an Access Expert so I don't know how to do what you suggested :-(
0
 
LVL 49

Expert Comment

by:Gustav Brock
ID: 40464711
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.

/gustav
0
 
LVL 35

Expert Comment

by:PatHartman
ID: 40464740
When you get the message, press cntl-break to stop the code.  Post the procedure (including the header).
0
 

Author Comment

by:Jagwarman
ID: 40464744
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
0
 
LVL 49

Expert Comment

by:Gustav Brock
ID: 40464751
So it is a coding issue. Follow the advice from Pat.

/gustav
0
 

Author Comment

by:Jagwarman
ID: 40464763
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.
0
 
LVL 49

Expert Comment

by:Gustav Brock
ID: 40464781
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?

/gustav
0
 
LVL 35

Accepted Solution

by:
PatHartman earned 500 total points
ID: 40464788
There is no need to save the record at this point.  The record will automatically be saved as you can see.   Remove the procedure.

Also, this is code from A95.  Access hasn't had menus since A2007 was released and they were replaced by the ribbon so who knows how much longer MS will continue to support DoMenuItem.

To save the current record:
DoCmd.RunCommand acCmdSaveRecord
Or in rare cases, you might need to use
If Me.Dirty = True Then
    Me.Dirty = False  'force record to be saved
End If

The Me.Dirty = False is a trick and it is not obvious that the statement is forcing the record to be saved so I recommend a comment if you use it.
0
 
LVL 26

Expert Comment

by:Nick67
ID: 40464807
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?
0
 

Author Comment

by:Jagwarman
ID: 40466236
Looks like mine is one of those rare cases. Thanks.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article is a continuation or rather an extension from Cascading Combos (http://www.experts-exchange.com/A_5949.html) and builds on examples developed in detail there. It should be understandable alone, but I recommend reading the previous artic…
A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question