SQL for simple delete, based on date field

SQL for simple delete, based on date field

Post by Mike Hugh » Thu, 19 Aug 1999 04:00:00



I am trying to delete records from a mdb based on the value of a variable, but
it doesn't seem to do any kind of updating. . .  here is the sequence

(ADO connection)

'clear "old" data (for any given month)
cmdPopulate.CommandType = adCmdText
cmdPopulate.CommandText = "delete from Means2 where Update_Date= #" +
stFiledata1 + "#;"
cmdPopulate.Execute
Operator_Services.Refresh

if anyone has any idea why this isn't deleting any files is I would appreciate
any advice. . . note: the field Update_Date is a Date type field in Access

TIA

Mike Hughes

 
 
 

SQL for simple delete, based on date field

Post by Steve Vereeck » Thu, 19 Aug 1999 04:00:00


Quote:> cmdPopulate.CommandText = "delete from Means2 where Update_Date= #" +

try delete * from ....

try select * from ... to first veryfy the output.

also , i don't know the exact syntax, but doesn't :

docmd.runsql "delete * from means2 where Update_dat = #" & strfiledata & "#;

may have to use " and ' after eachothr , not sure, in Access thats what I
would do . This is ms sql


Quote:> I am trying to delete records from a mdb based on the value of a variable,
but
> it doesn't seem to do any kind of updating. . .  here is the sequence

> (ADO connection)

> 'clear "old" data (for any given month)
> cmdPopulate.CommandType = adCmdText
> cmdPopulate.CommandText = "delete from Means2 where Update_Date= #" +
> stFiledata1 + "#;"
> cmdPopulate.Execute
> Operator_Services.Refresh

> if anyone has any idea why this isn't deleting any files is I would
appreciate
> any advice. . . note: the field Update_Date is a Date type field in Access

> TIA

> Mike Hughes


 
 
 

SQL for simple delete, based on date field

Post by BPMargoli » Thu, 19 Aug 1999 04:00:00


Mike,

Access uses # as date delimiters. SQL Server uses single quotes as date
delimiters.


Quote:> I am trying to delete records from a mdb based on the value of a variable,
but
> it doesn't seem to do any kind of updating. . .  here is the sequence

> (ADO connection)

> 'clear "old" data (for any given month)
> cmdPopulate.CommandType = adCmdText
> cmdPopulate.CommandText = "delete from Means2 where Update_Date= #" +
> stFiledata1 + "#;"
> cmdPopulate.Execute
> Operator_Services.Refresh

> if anyone has any idea why this isn't deleting any files is I would
appreciate
> any advice. . . note: the field Update_Date is a Date type field in Access

> TIA

> Mike Hughes