TerenceHewett
asked on
Run-time error '3219': Invalid operation
Hi experts,
I have the following code that puts an ID into a field in the table tblPSX.
Dim db As Database
Dim rs As Recordset
Set rs = CurrentDb.OpenRecordset("t blPSX", dbOpenTable)
rs.MoveFirst
'Updating the records
Do Until rs.EOF = True
With rs
.Edit
PS=!PSID
.Update
End With
rs.MoveNext
Loop
Set rs = Nothing
Set db = Nothing
The code works fine if tblPSX is not a linked table, but if the table is linked I get the following message:
Run-time error '3219': Invalid operation
When I debug, the highlighted text is "Set rs = CurrentDb.OpenRecordset("t blPSX", dbOpenTable)".
Can anyone help?
Thank you.
Terry
I have the following code that puts an ID into a field in the table tblPSX.
Dim db As Database
Dim rs As Recordset
Set rs = CurrentDb.OpenRecordset("t
rs.MoveFirst
'Updating the records
Do Until rs.EOF = True
With rs
.Edit
PS=!PSID
.Update
End With
rs.MoveNext
Loop
Set rs = Nothing
Set db = Nothing
The code works fine if tblPSX is not a linked table, but if the table is linked I get the following message:
Run-time error '3219': Invalid operation
When I debug, the highlighted text is "Set rs = CurrentDb.OpenRecordset("t
Can anyone help?
Thank you.
Terry
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Researching further, you should be able to open a recordset on a linked table. Can you open the tblPSX from the front end?
me thinks, linked table is from SQL or other db that uses ODBC
ASKER
As always, a first class response and I am very grateful.
ASKER
Thanks for all posts - Cap, the following worked a treat:
Set rs = CurrentDb.OpenRecordset("t blPSX",dbo pendynaset )
Regards.
Terry
Set rs = CurrentDb.OpenRecordset("t
Regards.
Terry
Set rs = CurrentDb.OpenRecordset("S
BTW: You are not using "db" so you don't need:
Dim db As Database
Set db = Nothing