Kevin Willyerd
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.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
select *
from tablex
where weekday([datefield])=7 and [timefield]> timeserial(18,0,0)
from tablex
where weekday([datefield])=7 and [timefield]> timeserial(18,0,0)
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].
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)
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)
ASKER
Thank you, Swift and exactly what I needed.
& any chance of you telling us the table name and the field names?