View Full Version : Query by Non-blank field


Djblois
04-21-2009, 06:07 AM
this is my query and it should filter out all records that are blank in the departure field. However, it isn't filtering them out:

SELECT Scheduled_Appts.Appt_Date, Scheduled_Appts.Carrier, Scheduled_Appts.Sch_Time, Scheduled_Appts.Arr_Time, Scheduled_Appts.Missing_PaperWork, Scheduled_Appts.Incoming, Scheduled_Appts.Appt_ID, Scheduled_Appts.Outgoing, Scheduled_Appts.Dep_Time, Scheduled_Appts.Created_by, Scheduled_Appts.Created_Date, Scheduled_Appts.Last_Modified_by, Scheduled_Appts.Last_Modified_Date, Scheduled_Appts.Confirmation_Num, Scheduled_Appts.Arr_Date
FROM Scheduled_Appts
WHERE ((((Scheduled_Appts.Appt_Date)=[Forms]![frmScheduled_Appts]![cldrApptDates]) AND ((Scheduled_Appts.Incoming)=[Forms]![frmScheduled_Appts]![cbViewRec]) OR (((Scheduled_Appts.Appt_Date)=[Forms]![frmScheduled_Appts]![cldrApptDates]) AND ((Scheduled_Appts.Outgoing)=[Forms]![frmScheduled_Appts]![cbViewShip]))) AND ((Scheduled_Appts.Dep_Time) Is Not Null))
ORDER BY Scheduled_Appts.Sch_Time, Scheduled_Appts.Arr_Time, Scheduled_Appts.Carrier;

I think maybe the "AND ((Scheduled_Appts.Dep_Time) Is Not Null))" is in the wrong place or something like that but I can't see what I am doing wrong.

Brianwarnock
04-21-2009, 06:57 AM
Matching up your brackets suggests that 2 are missing around your first AND grouping, shown in red, however that should not cause your particular problem. Have you tried just the Is not Null condition by itself?

Brian

WHERE
(
(
(
((Scheduled_Appts.Appt_Date)=[Forms]![frmScheduled_Appts]![cldrApptDates]) AND
((Scheduled_Appts.Incoming)=[Forms]![frmScheduled_Appts]![cbViewRec])
)
OR
(
((Scheduled_Appts.Appt_Date)=[Forms]![frmScheduled_Appts]![cldrApptDates]) AND ((Scheduled_Appts.Outgoing)=[Forms]![frmScheduled_Appts]![cbViewShip])
)
)
AND ((Scheduled_Appts.Dep_Time) Is Not Null)
)

Brianwarnock
04-22-2009, 08:07 AM
Did this get sorted?

Brian

Djblois
04-22-2009, 08:22 AM
Yes, sorry I fixed it about 1 hour ago. Thank you for your help