Solved

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

Posted on 2014-11-25
13
424 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 5
  • 2
  • +1
13 Comments
 
LVL 50

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 50

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
U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

 

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 50

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 37

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 50

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 50

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 37

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

Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

Question has a verified solution.

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

A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
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.

737 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