Solved

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

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

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 34

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
Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 

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 34

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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

It took me quite some time to sort out all the different properties of combo and list boxes available from Visual Basic at run-time. Not that the documentation is lacking: the help pages are quite thorough and well written. The problem was rather wh…
QuickBooks® has a great invoice interface that we were happy with for a while but that changed in 2001 through no fault of Intuit®. Our industry's unit names are dictated by RUS: the Rural Utilities Services division of USDA. Contracts contain un…
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…

707 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now