Insert into Date query

John.Woody

Registered User.
Local time
Today, 13:25
Joined
Sep 10, 2001
Messages
354
If this works
Dim dbs as Database
Dim D

Set dbs = Currentdb

D = Year(Forms!F_Archive!EndDate) ‘ e.g. 15/12/2000

dbs.Execute "Insert Into ArcHD Select * From Holiday_Details WHERE ((Year(Date_of_Departure)<=" & D & " AND (HolidayID)>" & 1 & "));"

with Year, why doesn’t it work below without Year?

Dim D

D = Forms!F_Archive!EndDate ‘ e.g. 15/12/2000

dbs.Execute "Insert Into ArcHD Select * From Holiday_Details WHERE (((Date_of_Departure)<=" & D & " AND (HolidayID)>" & 1 & "));"

Any thoughts greatly appreciated.
 
Try this:

dbs.Execute "Insert Into ArcHD Select * From Holiday_Details WHERE (((Date_of_Departure)<=" & "#" & D & "#" & " AND (HolidayID)>" & 1 & "));"
 
Thanks Cpod, I'd tried all sorts of things but not that. It works a treat.
 

Users who are viewing this thread

Back
Top Bottom