Solved

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

Posted on 2014-11-25
13
387 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
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 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

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Launch app from Access custom ribbon 8 33
Create macro from runcode 30 26
VBA SQL statement - 2 "OR"s and 1 "And" 4 27
Formatting Excel Data as Table from Access 11 12
Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

778 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