Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
SM SM is offline
external usenet poster
 
Posts: 1
Default getting runtime error when trying to delete records

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 31
Default getting runtime error when trying to delete records

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" wrote in message
...
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.
When I run following delete query,
sqlstr = "Delete * FROM Table1 WHERE (Name = '" & comd & "' AND TIMEFRAME

= '" & tf & "');"
objConn.Execute sqlstr

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


Thanks in advance...
Regards
Smita



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Delete records when certain records have duplicate column data JVroom New Users to Excel 1 January 26th 09 06:23 PM
Excel 2003 Macro Error - Runtime error 1004 Cow Excel Discussion (Misc queries) 2 June 7th 05 01:40 PM
runtime error '1004' delete Method of Range Class Failed Tom Kennedy Excel Programming 0 April 14th 04 08:08 PM
runtime error '1004' delete Method of Range Class Failed Tom Ogilvy Excel Programming 0 April 1st 04 04:09 AM
Syntax Error Runtime Error '424' Object Required sjenks183 Excel Programming 1 January 23rd 04 09:25 AM


All times are GMT +1. The time now is 10:10 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"