linbayzak
asked on
need criteria to pull data from today and yesterday in microsoft access
Hi Experts,
I have a combo box with a rowsource of
SELECT [Scrap Ticket].ID, [Scrap Ticket].[Date Shift Run:], [Scrap Ticket].GLPart, [Scrap Ticket].[Material Type:], [Scrap Ticket].[Tube Description:]
FROM [Scrap Ticket]
WHERE ((([Scrap Ticket].Operator)=[Forms]! [Switchboa rd]![txtUs erName]))
GROUP BY [Scrap Ticket].ID, [Scrap Ticket].[Date Shift Run:], [Scrap Ticket].GLPart, [Scrap Ticket].[Material Type:], [Scrap Ticket].[Tube Description:]
HAVING ((([Scrap Ticket].[Date Shift Run:])>=Date() And ([Scrap Ticket].[Date Shift Run:])=Date()-1))
ORDER BY [Scrap Ticket].[Date Shift Run:] DESC;
which i thought would pick up all entries for this user between yesterday and today so that the third shift will still be able to access their data entered on that shift even after the date changes at midnight.
Is something wrong with my criteria.....
Date() AND Date()-1
Thanks
Laura
I have a combo box with a rowsource of
SELECT [Scrap Ticket].ID, [Scrap Ticket].[Date Shift Run:], [Scrap Ticket].GLPart, [Scrap Ticket].[Material Type:], [Scrap Ticket].[Tube Description:]
FROM [Scrap Ticket]
WHERE ((([Scrap Ticket].Operator)=[Forms]!
GROUP BY [Scrap Ticket].ID, [Scrap Ticket].[Date Shift Run:], [Scrap Ticket].GLPart, [Scrap Ticket].[Material Type:], [Scrap Ticket].[Tube Description:]
HAVING ((([Scrap Ticket].[Date Shift Run:])>=Date() And ([Scrap Ticket].[Date Shift Run:])=Date()-1))
ORDER BY [Scrap Ticket].[Date Shift Run:] DESC;
which i thought would pick up all entries for this user between yesterday and today so that the third shift will still be able to access their data entered on that shift even after the date changes at midnight.
Is something wrong with my criteria.....
Date() AND Date()-1
Thanks
Laura
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
perfect, thanks :-)
These rules are impossible to meet. If the date must be equal to yesterday it cannot also be greater than or equl to today.
Unless you have records going into the future then all you need is..
HAVING [Scrap Ticket].[Date Shift Run:]>=Date()-1