Solved

Need Criteria For Day of week and time range in MS Access query

Posted on 2014-09-13
6
700 Views
Last Modified: 2014-09-13
I have a table of transactions which includes  a field for Date and another for time. I need to select all records for Saturday  later than 18:00.
0
Comment
Question by:PetGuy
6 Comments
 
LVL 48

Expert Comment

by:PortletPaul
ID: 40321250
all Saturdays,  just the "last Saturday", or something else?

& any chance of you telling us the table name and the field names?
0
 
LVL 26

Accepted Solution

by:
MacroShadow earned 500 total points
ID: 40321256
Select * FROM YourTable WHERE Weekday(DateField) = 7 AND TimeField > #18:00#
0
 
LVL 119

Expert Comment

by:Rey Obrero
ID: 40321259
select *
from tablex
where weekday([datefield])=7 and [timefield]> timeserial(18,0,0)
0
Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

 

Author Comment

by:PetGuy
ID: 40321264
All Saturdays. I need to look at sales totals for that time period over the last couple of years. If I can get a query that selects just that period it is easy for me to write a report that will give me the numbers I need. Besides I might just learn something.

The table is [Product History]  Fields of relevance are [Product Code], [Description One], [Sales Value], [Transaction Date] and [Transaction Time].
0
 
LVL 119

Expert Comment

by:Rey Obrero
ID: 40321282
try this query

select [Product Code], [Description One], [Sales Value], [Transaction Date], [Transaction Time]
From  [Product History]
Where Weekday([Transaction Date])= 7 And  [Transaction Time] > Timeserial(18,0,0)
0
 

Author Closing Comment

by:PetGuy
ID: 40321298
Thank you, Swift and exactly what I needed.
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

This article describes how to use the timestamp of existing data in a database to allow Tableau to calculate the prior work day instead of relying on case statements or if statements to calculate the days of the week.
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

706 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now