Link to home
Start Free TrialLog in
Avatar of Kevin Willyerd
Kevin WillyerdFlag for United States of America

asked on

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

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.
Avatar of PortletPaul
PortletPaul
Flag of Australia image

all Saturdays,  just the "last Saturday", or something else?

& any chance of you telling us the table name and the field names?
ASKER CERTIFIED SOLUTION
Avatar of Joe Howard
Joe Howard
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
select *
from tablex
where weekday([datefield])=7 and [timefield]> timeserial(18,0,0)
Avatar of Kevin Willyerd

ASKER

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].
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)
Thank you, Swift and exactly what I needed.