UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
 
   Reply to this topicStart new topic
> Continue Status Check With Out Repeating., Access 2016    
 
   
MrFormula
post May 24 2020, 03:52 PM
Post#1



Posts: 732
Joined: 28-May 05



Simple queries trip me up and I just can't figure this out.
I have two tables:
VehicleCheckList - History of items that have been checked. Date Checked, Description of what was wrong
VehicleSpecificCheckItems - List of items specifically for this vehicle.

So I am a little frustrated that I can't figure this out. I want to be able to be working on a vehicle checking on that vehicle...Get interrupted then come back to that vehicle later. I don't want to check the items that are already checked. Here is the query that is not working. I have vehicle 4 "hard coded for testing purposes.
Each time I come back to this vehicle to continue I still get all of the items. I tried to use the dateDiff to filter out all items that have been checked in the last 5 days.

Thanks in advance for the help.

CODE
SELECT DISTINCTROW VehicleSpecificCheckItems.ListOrder, VehicleSpecificCheckItems.DefaultValues, VehicleSpecificCheckItems.Description, VehicleSpecificCheckItems.VehicleID, VehicleSpecificCheckItems.VehicleCheckItemsID, VehicleSpecificCheckItems.DescriptionES, VehicleCheckList.CheckDate
FROM VehicleSpecificCheckItems LEFT JOIN VehicleCheckList ON VehicleSpecificCheckItems.VehicleSpecificCheckItemsID = VehicleCheckList.VehicleCheckItemsID
WHERE (((VehicleSpecificCheckItems.VehicleID)=4) AND ((VehicleCheckList.CheckDate)>=DateDiff("d",-5,Date()) Or (VehicleCheckList.CheckDate) Is Null))
ORDER BY VehicleSpecificCheckItems.ListOrder;
Go to the top of the page
 
MrFormula
post May 24 2020, 05:26 PM
Post#2



Posts: 732
Joined: 28-May 05



I may have figured it out.
This seems to work

CODE
SELECT DISTINCTROW VehicleSpecificCheckItems.ListOrder, VehicleSpecificCheckItems.DefaultValues, VehicleSpecificCheckItems.Description, VehicleSpecificCheckItems.VehicleID, VehicleSpecificCheckItems.VehicleCheckItemsID, VehicleSpecificCheckItems.DescriptionES, VehicleCheckList.CheckDate
FROM VehicleSpecificCheckItems LEFT JOIN VehicleCheckList ON VehicleSpecificCheckItems.VehicleCheckItemsID = VehicleCheckList.VehicleCheckListID
WHERE (((VehicleSpecificCheckItems.VehicleID)=4) AND ((VehicleCheckList.CheckDate)>=DateDiff("d",-5,Date()) Or (VehicleCheckList.CheckDate) Is Null))
ORDER BY VehicleSpecificCheckItems.ListOrder;

Go to the top of the page
 


Custom Search


RSSSearch   Top   Lo-Fi    7th July 2020 - 02:14 AM