Solved

need criteria to pull data from today and yesterday in microsoft access

Posted on 2011-03-16
3
540 Views
Last Modified: 2012-05-11
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]![Switchboard]![txtUserName]))
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
0
Comment
Question by:linbayzak
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 5

Accepted Solution

by:
DoveTails earned 500 total points
ID: 35149873
May want to try using only the greater than or equal to date minus one:

HAVING [Scrap Ticket].[Date Shift Run:]>=Date()-1)
0
 
LVL 77

Expert Comment

by:peter57r
ID: 35149877
And ([Scrap Ticket].[Date Shift Run:])=Date()-1))

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
0
 

Author Closing Comment

by:linbayzak
ID: 35150649
perfect, thanks :-)
0

Featured Post

Enroll in June's Course of the Month

June's Course of the Month is now available! Every 10 seconds, a consumer gets hit with ransomware. Refresh your knowledge of ransomware best practices by enrolling in this month's complimentary course for Premium Members, Team Accounts, and Qualified Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
In earlier versions of Windows (XP and before), you could drag a database to the taskbar, where it would appear as a taskbar icon to open that database.  This article shows how to recreate this functionality in Windows 7 through 10.
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

719 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question