Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Deleting records based on date not working 1

Status
Not open for further replies.

vamoose

Programmer
Oct 16, 2005
320
MX
Hello, I am having difficulity deleting records based on a date. I am using Access 2003 and the following VBA code. I get no errors but the records fail to delete. In the 2 tables PDate is data type Date/Time. DeleteDate = 8/12/2008

VBA code:

Dim DeleteDate as Date

Path = "\\serverms001\Common\Production\Winding\Working\Master.mdb"
DoCmd.RunSQL "Delete * from ABS_Daily IN '" & Path & "' where PDate = " & DeleteDate
DoCmd.RunSQL "Delete * from Flex_Winder IN '" & Path & "' where PDate = " & DeleteDate

Thank you all.
 
Try:

DoCmd.RunSQL "Delete * from ABS_Daily IN '" & Path & "' where PDate = #" & Format(DeleteDate,"yyyy/mm/dd") & "#
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top