I have the following code to delete records from a database. The problem seems to be with the date field; if I use a different parameter, for example, delete all records where Lastname = "smith", the code works fine. But I cannot get this to match records with the date entered in the form field "CreatedON"
Dim ThisDate As Date
ThisDate = Me!CreatedON
Dim db As DAO.Database
Dim SQL As String
SQL = "Delete * from [RegularHours] Where [RegularHours].[DayScheduleSet] = " & "#" & ThisDate & "#"
' SQL = "Delete * from RegularHours " & _
'"Where RegularHours.RegID = 47642"
Set db = CurrentDb()
db.Execute SQL
MsgBox ("All Done")
Any ideas ?
Dim ThisDate As Date
ThisDate = Me!CreatedON
Dim db As DAO.Database
Dim SQL As String
SQL = "Delete * from [RegularHours] Where [RegularHours].[DayScheduleSet] = " & "#" & ThisDate & "#"
' SQL = "Delete * from RegularHours " & _
'"Where RegularHours.RegID = 47642"
Set db = CurrentDb()
db.Execute SQL
MsgBox ("All Done")
Any ideas ?