|
 |
access thread: unresolvable 'Invalid Operation' run-time error
Message #1 by "Saad Masood" <saadahmed42@h...> on Wed, 30 Oct 2002 07:31:42
|
|
I'm getting the following error when I try UPDATE or INSERT SQL statements
from VBA thru DAO. The error says:
'Run Time Error = 3219
Invalid Operation'
My code is below. FYI, the queries run successfully, when executed
individually from within Access in a Query Object. I feel as if there is
something wrong with the OpenRecordSet statement, like I'm suppose to
specify different options with it to enable editing and inserting of
tables.
Dim Myrs As DAO.Recordset
Dim db As DAO.Database
Dim Newrs As DAO.Recordset
Set db = CurrentDb()
Set MyRs = db.OpenRecordset("Select * from EventScheduling where
TransNumber = 8637;",dbOpenDynaset)
If MyRs.recordcount > 0 Then
Set NewRs = db.OpenRecordset("Update EventScheduling set EventDate =
#10/31/2010# where TransNumber = 8637;",dbOpenDynaset)
Else
Set NewRs = db.OpenRecordset("INSERT INTO EventScheduling
(EventDate,EventTitle) VALUES (#10/31/2010#,'Graduation');",dbOpenDynaset)
End If
End Sub
I get run-error on both the UPDATE OpenRecordset as well as the INSERT
OpenRecordSet Statements...whichever one of them runs..
Saad
Message #2 by "Haslett, Andrew" <andrew.haslett@i...> on Wed, 30 Oct 2002 19:18:04 +1030
|
|
When you execute an UPDATE statement, there are no results returned - ie no
recordset.
Therefore you are not assigning anythign to MyRS. Change that line to:
DoCmd.RunSQL ("Update EventScheduling set EventDate =
#10/31/2010# where TransNumber = 8637")
Cheers,
Andrew
-----Original Message-----
From: Saad Masood [mailto:saadahmed42@h...]
Sent: Wednesday, 30 October 2002 6:02 PM
To: Access
Subject: [access] unresolvable 'Invalid Operation' run-time error
I'm getting the following error when I try UPDATE or INSERT SQL statements
from VBA thru DAO. The error says:
'Run Time Error = 3219
Invalid Operation'
My code is below. FYI, the queries run successfully, when executed
individually from within Access in a Query Object. I feel as if there is
something wrong with the OpenRecordSet statement, like I'm suppose to
specify different options with it to enable editing and inserting of
tables.
Dim Myrs As DAO.Recordset
Dim db As DAO.Database
Dim Newrs As DAO.Recordset
Set db = CurrentDb()
Set MyRs = db.OpenRecordset("Select * from EventScheduling where
TransNumber = 8637;",dbOpenDynaset)
If MyRs.recordcount > 0 Then
Set NewRs = db.OpenRecordset("Update EventScheduling set EventDate =
#10/31/2010# where TransNumber = 8637;",dbOpenDynaset)
Else
Set NewRs = db.OpenRecordset("INSERT INTO EventScheduling
(EventDate,EventTitle) VALUES (#10/31/2010#,'Graduation');",dbOpenDynaset)
End If
End Sub
I get run-error on both the UPDATE OpenRecordset as well as the INSERT
OpenRecordSet Statements...whichever one of them runs..
Saad
IMPORTANT - PLEASE READ ********************
This email and any files transmitted with it are confidential and may
contain information protected by law from disclosure.
If you have received this message in error, please notify the sender
immediately and delete this email from your system.
No warranty is given that this email or files, if attached to this
email, are free from computer viruses or other defects. They
are provided on the basis the user assumes all responsibility for
loss, damage or consequence resulting directly or indirectly from
their use, whether caused by the negligence of the sender or not.
|
|
 |