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.
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?
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.
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
When I run the macro it loops through 20 times and give me a error that a Macro can only call itself a maximum of 20 times.
If I run the Bat file I get a error that The command or action “Run” isn’t available now.
I have an open form command with a where "[ID]=" & Nz([ID],0) statement.
This works well. The problem is that when the subform opens, and data is entered, I have a command button to start a procedure based on the PK ([ID]). Since no ID exists yet (assigned onsave), the function requiring the PK reports no valid PK.
I have attempted to insert an
if me.dirty then me.dirty=false
but then it replaces the data in the form with #deleted and give me a write conflict error when I attempt to save the record again (close form).
How do I save the record to assign the PK in [ID] and then pass that value to the functions that require it?