Solved

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

Posted on 2009-07-14
3
261 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

The New “Normal” in Modern Enterprise Operations

DevOps for the modern enterprise offers many benefits — increased agility, productivity, and more, but digital transformation isn’t easy, especially if you’re not addressing the right issues. Register for the webinar to dive into the “new normal” for enterprise modern ops.

Question has a verified solution.

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

Suggested Solutions

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.
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

821 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