?
Solved

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

Posted on 2014-11-25
13
Medium Priority
?
509 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 51

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 51

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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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 51

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 38

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 51

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 51

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 38

Accepted Solution

by:
PatHartman earned 2000 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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

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.
As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
Suggested Courses

770 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