Run Time error 2046 Command action save record
When the check In button is clicked, I am getting a run time error 2046. The command or action ‘Save Record’ isn’t available.
Thank you for taking the time to report an issue.
What's wrong... Please write below.
"Command or Action 'SaveRecord' isn't available now.
Run-time error '2046'
I'm not trying to save any record or anything and I am just trying to get out of the application when a report is open.
If Not Me.NewRecord Then RunCommand acCmdRecordGoToNew
Depending on the order of these two statements I get a different problem.
If I use the order shown, the RecordGoToNew works but it is effectively undone by the requery. If I add another RecordGoToNew line I get error 2046: The command or action 'RecordGoToNew' isn't available now.
If I switch order I receive the 2046 error.
It seems that a requery prevents the GoToNew from working.
So far I have avoided doing the requery at all but how do I introduce it without creating a problem?
There is one field on the form , DocID, which has the name of a document. When the form is loaded, I want the docID to be copied onto the clipboard so the user can paste this into another program without having to do a manual keyboard or mouse routine. After doing the copy, it moves the focus to the next field where a user could paste his results.
So, for the oncurrent event I wrote:
'copy the doc id value to the clipboard
'Move focus to DocID1 field
This works great if you acutally work with the record. No problems. The problem arises when/if the user scrolls through the records, instead of updating the record. Then I get the error:
Run-time Error '2046':
The command or action 'copy' isn't available now.
When I hit debug, it goes to the line: DoCmd.RunCommand acCmdCopy
Can anyone help me figure out why this doesn't work when you are browsing/scrolling through the recordset
The macro worked fine. I then have tried to run the command from vba (so that I may easily alter the output location and file name on the fly).
I'm stuck on the 2046 error. Thinking there might be a problem with the variable stDocName, I tried the the report name as a quoted string --still get the error.
For some background on what I am trying to accomplish here. I have a table that contains the PersonnelName, email, cc, subject respectively and are all text fields. The code calls a recordset to "lookup" the respective fields and produce an email with the report attached. I am not so worried about saving the report as attaching it to the email to be sent out as this is done daily. Oh I should probably mention this is all done by clicking a command button. So how would I go about producing the pdf for attachment?
The error that is recorded (I write errors to a table rather than display them on the screen) is Error 2046 - "The command or action'OutputTo' isn't available now."
(where fileName = "C:\Reports")
DoCmd.OutputTo acOutputReport, "RptFinal", acFormatPDF, fileName, 0
Yet it works fine on a number of PC's with the full version of Access. If I change the windows task on the PC using full access to call Access using the runtime switch, it fails there as well. But remove the runtime switch and it's fine.
We are using Windows XP SP3 and Office 2010 SP1
Is there an easy way to check within the form when it is open whether it is Read-Only or Edit mode?
My need for this is to avoid a 2046 error 'SaveRecord' isn't available now as I do need to force save (Docmd.RunCommand.AcCmdSaveRecord) the record before Closing when it is in Edit mode.
I have looked around and seen some suggestions based around the AllowEdit property but that is not the solution. Using acFormOpenDataMode enumeration looked interesting too but that to seems not to be the answer either.
I have managed a work around that uses a check on the same User's name as part of an IF statement as to whether to run the save command code.
Essentially I suppose this is the same process as checking IF formname = readonly then close else save then close but I feel we need to get to the nub of the problem rather than a workaround