getting runtime error when trying to delete records

G

Guest

Hi All

I am using VBA 6.3 and Access 2002. My program works fine on machine which has windows 2000 operating system (SP2) but sometime it gives error when I run this program on another machine which also has Windows 2000 operating System(SP 4

I have one Subroutine in which I am doing following thing

• Connecting to Database using ADODB.Connection objec
• Selecting specific records from a table1 using RecordSet.Open method using following cod
sqlstr = "SELECT * FROM Table1 WHERE (Name = '" & comd & "' AND TIMEFRAME = '" & tf & "') ORDER BY PRICE DESC;

rsF.OPEN sqlstr, dbConnect, adOpenKeyset, adLockReadOnly, adCmdTex

• If I find more than 1 record as result of select query, I am finding out more specific records(subset of first select query) and inserting it into new table called table2 which has same columns as table
• Then setting recordset to nothing â€
Set rsF = Nothin

• Now I want to delete all records from Table1 which qualify as a result of select query I ran previously and insert only sorted records into Table1 from Table2
When I run following delete query,
sqlstr = "Delete * FROM Table1 WHERE (Name = '" & comd & "' AND TIMEFRAME = '" & tf & "');
objConn.Execute sqlst

I am getting following error messag
runtime error'-2147467259(80004005)':could not update; Currently locke

Thanks in advance..
Regard
Smita
 
T

Township of East Hanover

This newsgroup is for Excel only you may want to try and post your question
in an Access group such as:

microsoft.public.access.formsprogramming


SM said:
Hi All,

I am using VBA 6.3 and Access 2002. My program works fine on machine
which has windows 2000 operating system (SP2) but sometime it gives error
when I run this program on another machine which also has Windows 2000
operating System(SP 4)
I have one Subroutine in which I am doing following things

. Connecting to Database using ADODB.Connection object
. Selecting specific records from a table1 using RecordSet.Open method using following code
sqlstr = "SELECT * FROM Table1 WHERE (Name = '" & comd & "' AND TIMEFRAME
= '" & tf & "') ORDER BY PRICE DESC;"
rsF.OPEN sqlstr, dbConnect, adOpenKeyset, adLockReadOnly, adCmdText

. If I find more than 1 record as result of select query, I am finding out
more specific records(subset of first select query) and inserting it into
new table called table2 which has same columns as table1
. Then setting recordset to nothing .
Set rsF = Nothing

. Now I want to delete all records from Table1 which qualify as a result
of select query I ran previously and insert only sorted records into Table1
from Table2.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top