Solved

MS Access Query help, querying for certain days between 2 dates.

Posted on 2009-07-14
3
259 Views
Last Modified: 2012-05-07
I have a query in Access that queries Oracle tables and pulls data based on a specified date range...start date and end date.  What I would like to be able to do, without using VBA if possible, is to use the query I currently have to pull data for a date range, but specify only certain weekdays that I want, i.e Mon-Thur.

So when a user enters a start date and an end date, the query will return data between those dates for Monday through Thursday only.  Is this possible?  If not I will just write the VBA code to do it instead...thanks.
0
Comment
Question by:rgn2121
3 Comments
 
LVL 2

Expert Comment

by:onethreefour
ID: 24856710
Could you use the to_char function?  
http://www.easywebtech.com/Oracle_Day_Of_Week.html

Convert your date field to a day of the week numerical equiv with to_char(DATEFIELD, 'D')...
....where to_char(DATEFIELD, 'D') > 1 and to_char(DATEFIELD, 'D') < 5....
Forgive my syntax, I am a mysql guy not oracle  ;]
0
 
LVL 4

Accepted Solution

by:
Nicolaze earned 500 total points
ID: 24856711
If the table you want to query contains the field fdate for the date, you write the following

SELECT Table.*
FROM Table
WHERE (((Table.fdate)>=[enter date1] And (Table1.fdate)<=[enter date2]) AND ((Weekday([fdate])) Between 1 And 4));
0
 
LVL 12

Author Closing Comment

by:rgn2121
ID: 31603596
perfect...thanks
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
HasData 9 37
how to address a subform in a form, from inside another subform 2 24
How to free up undo space? 3 29
Update Access FrontEnd by Version # 9 23
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.
A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
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…

910 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

17 Experts available now in Live!

Get 1:1 Help Now