pcalabria
asked on
Getting an Invalid Operation error when code executed from inside an MS Access vba routine
I'm getting an invalid operation message when the following line of code is executed:
strSQLtext = "UPDATE ComponentMaster SET OrderNumberNoSync = true WHERE searchnumber='" & strSearchNumber & "' And LineID = " & oRS!LineID
Set oRS2 = oDB.OpenRecordset(strSQLte xt)
When I print strSQLtext in the immediate window, then copy it to a query outside the routine, it runs without issue.
invalid-operation.txt
strSQLtext = "UPDATE ComponentMaster SET OrderNumberNoSync = true WHERE searchnumber='" & strSearchNumber & "' And LineID = " & oRS!LineID
Set oRS2 = oDB.OpenRecordset(strSQLte
When I print strSQLtext in the immediate window, then copy it to a query outside the routine, it runs without issue.
invalid-operation.txt
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
You may have cut off too much of the code. Put a stop in the code and print the SQL string to the immediate window. If you don't see the problem, copy it and paste it into the QBE and try to run it from there.
Based on the error message, chances are excellent that the form that is running this code is bound to the form that is running it and the current record is dirty.
Based on the error message, chances are excellent that the form that is running this code is bound to the form that is running it and the current record is dirty.
Well, this is another issue, not related to your first question.
Close this post and open a new one.
Close this post and open a new one.
ASKER