This is a VBA module created in an MS Access environment. This MS Access Db has a linked table called "lkTable" setup to access data in a MS SQL table (via odbc.)
The current codes read:
dim RS as DAO.recordset
set RS = currentdb.openrecordset("Select * from lkTable where xxx='xxxx'")
do
rem read data, create report based on data
rem no data modification statement
RS.delete
RS.movenext
if RS.eof then exit do
loop
That is a very simple piece of code and it simply delete the record after reading its information. The codes runs 99% of the time. But it gives out Runtime error 3156 occasionally when the statement RS.delete is run within the do loop.
The error message reads:
ODBC-delete on a linked table lkTable failed.
I bet the codes will never fail if this is the only process that access the underlying table.
What if there are other processes that will add/delete entries to the table? In fact I know there are and I know exactly what they are doing. Can I modify the above piece of codes so that it could always delete the records it has processed?
The current codes read:
dim RS as DAO.recordset
set RS = currentdb.openrecordset("Select * from lkTable where xxx='xxxx'")
do
rem read data, create report based on data
rem no data modification statement
RS.delete
RS.movenext
if RS.eof then exit do
loop
That is a very simple piece of code and it simply delete the record after reading its information. The codes runs 99% of the time. But it gives out Runtime error 3156 occasionally when the statement RS.delete is run within the do loop.
The error message reads:
ODBC-delete on a linked table lkTable failed.
I bet the codes will never fail if this is the only process that access the underlying table.
What if there are other processes that will add/delete entries to the table? In fact I know there are and I know exactly what they are doing. Can I modify the above piece of codes so that it could always delete the records it has processed?