I need help building a query expression that returns the records that don't meet certain criteria? I have a table "tblSchedule" that includes fields "TrainID", "DateID" (1,2)and "DateTypeID" (1,2,3,4), as well as other fields. There can be multiple records for each TrainID with various DateID's and DateTypeID's. How do I build an expression that (1) returns records that don't have DateID = 2 and DateTypeID =4, and (2) also eliminates all records that have the same TrainID that were eliminated in part (1) but have say DateID =1 and DatetypeID =3?
I've tried the following and it does the first part, but records with matching TrainID are not eliminated.
SELECT tblShedule.TrainID, tblTrain.[Train#], tblShedule.DateTypeID, tblShedule.DateID, tblShedule.DateTime
FROM tblShedule INNER JOIN tblTrain ON tblShedule.TrainID = tblTrain.TrainID
WHERE ((([tblShedule]![DateTypeID])<>2)) OR ((([tblShedule]![DateID])<>4));
Thanks
I've tried the following and it does the first part, but records with matching TrainID are not eliminated.
SELECT tblShedule.TrainID, tblTrain.[Train#], tblShedule.DateTypeID, tblShedule.DateID, tblShedule.DateTime
FROM tblShedule INNER JOIN tblTrain ON tblShedule.TrainID = tblTrain.TrainID
WHERE ((([tblShedule]![DateTypeID])<>2)) OR ((([tblShedule]![DateID])<>4));
Thanks