G
Guest
Hi,
I have a form that "builds" an SQL statement depending on the selections on
the form. Everything works fine except for the last part of the statement
where a date criteria is set. The SQL statement, when executed, should return
records with a "QueueDate" <= 11/10/2004 but for some reason records are
returned with dates greater than 11/10/2004 as well. I'm stumped! Can someone
suggest where I may be going wrong. Here is a copy of my SQL statement:
SELECT
Format(IIf([lng_Priority]>2,[dte_TransportDate],[dte_BookingDate]+[dte_BookingTime]),'dd/mm/yy
hh:nn') AS QueueTime,
Format(IIf([lng_Priority]>2,[dte_TransportDate],[dte_BookingDate]),'dd/mm/yy')
AS QueueDate, tbl_Bookings.lng_BookingID AS ID, Tbl_Bookings.lng_Priority AS
Priority, tbl_Bookings.str_Surname & ", " & tbl_Bookings.str_Title & " " &
tbl_Bookings.str_FirstName AS Name, tbl_Locations.str_FullName AS Origin,
tbl_Locations_1.str_FullName AS Destination, Tbl_Bookings.str_Diagnosis AS
Diagnosis, Tbl_Bookings.str_Status AS Status FROM (Tbl_Bookings INNER JOIN
tbl_Locations ON Tbl_Bookings.lng_fromID = tbl_Locations.lng_LocationID)
INNER JOIN tbl_Locations AS tbl_Locations_1 ON Tbl_Bookings.lng_ToID =
tbl_Locations_1.lng_LocationID WHERE (((Tbl_Bookings.str_Status)= "Waiting"
AND
Format(IIf([lng_Priority]>2,[dte_TransportDate],[dte_BookingDate]),'dd/mm/yyyy') <= #11/10/2004#));
I have a form that "builds" an SQL statement depending on the selections on
the form. Everything works fine except for the last part of the statement
where a date criteria is set. The SQL statement, when executed, should return
records with a "QueueDate" <= 11/10/2004 but for some reason records are
returned with dates greater than 11/10/2004 as well. I'm stumped! Can someone
suggest where I may be going wrong. Here is a copy of my SQL statement:
SELECT
Format(IIf([lng_Priority]>2,[dte_TransportDate],[dte_BookingDate]+[dte_BookingTime]),'dd/mm/yy
hh:nn') AS QueueTime,
Format(IIf([lng_Priority]>2,[dte_TransportDate],[dte_BookingDate]),'dd/mm/yy')
AS QueueDate, tbl_Bookings.lng_BookingID AS ID, Tbl_Bookings.lng_Priority AS
Priority, tbl_Bookings.str_Surname & ", " & tbl_Bookings.str_Title & " " &
tbl_Bookings.str_FirstName AS Name, tbl_Locations.str_FullName AS Origin,
tbl_Locations_1.str_FullName AS Destination, Tbl_Bookings.str_Diagnosis AS
Diagnosis, Tbl_Bookings.str_Status AS Status FROM (Tbl_Bookings INNER JOIN
tbl_Locations ON Tbl_Bookings.lng_fromID = tbl_Locations.lng_LocationID)
INNER JOIN tbl_Locations AS tbl_Locations_1 ON Tbl_Bookings.lng_ToID =
tbl_Locations_1.lng_LocationID WHERE (((Tbl_Bookings.str_Status)= "Waiting"
AND
Format(IIf([lng_Priority]>2,[dte_TransportDate],[dte_BookingDate]),'dd/mm/yyyy') <= #11/10/2004#));