Delete Access record Where Status = D in Text File

linuxman
01-14-2004, 07:22 PM
I have the following code, am I missing something or is this not possible. I am trying to delete records from an access database where the status in a text file = X (for Delete). I am using an INSERT INTO statement to add all the statuses that = + and that is working fine. Have I missed something here major on the DELETE query.

Cn.Execute "DELETE * FROM TFNNos WHERE [Text;Database=" & PathtoTextFile & ";HDR=YES].[" & FileName & "] WHERE status = 'D'"

mikechan8888
01-14-2004, 11:44 PM
I have the following code, am I missing something or is this not possible. I am trying to delete records from an access database where the status in a text file = X (for Delete). I am using an INSERT INTO statement to add all the statuses that = + and that is working fine. Have I missed something here major on the DELETE query.

Cn.Execute "DELETE * FROM TFNNos WHERE [Text;Database=" & PathtoTextFile & ";HDR=YES].[" & FileName & "] WHERE status = 'D'"

Never tried doing something like this before. But how come you have 2 WHERE clauses in your DELETE statement? :confused:

Mike

linuxman
01-15-2004, 07:40 AM
I have the following code, am I missing something or is this not possible. I am trying to delete records from an access database where the status in a text file = X (for Delete). I am using an INSERT INTO statement to add all the statuses that = + and that is working fine. Have I missed something here major on the DELETE query.

Cn.Execute "DELETE * FROM TFNNos WHERE [Text;Database=" & PathtoTextFile & ";HDR=YES].[" & FileName & "] WHERE status = 'D'"

Never tried doing something like this before. But how come you have 2 WHERE clauses in your DELETE statement? :confused:

Mike
Mike, that is a good question, as much as I have looked at I missed that in the end. I have never done this before, I am just wondering if it is possible. I will take another look at it this evening. This is a side project nothging related to work so I have to review it in the evenings. A personal challenge.

MKoslof
01-15-2004, 07:49 AM
are you asking if a multiple where clause is valid within a delete statement? Sure it is :). See below, this leaves records that do not match both conditions

DELETE * FROM VBTest WHERE Document='Test.doc' AND Author='MKoslof';

mikechan8888
01-15-2004, 11:42 PM
are you asking if a multiple where clause is valid within a delete statement? Sure it is :). See below, this leaves records that do not match both conditions

DELETE * FROM VBTest WHERE Document='Test.doc' AND Author='MKoslof';
Should I call it one WHERE clause with multiple conditions? ;)

Mike

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum