Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2009-07-14
3
Medium Priority
?
265 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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 2000 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

Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

Question has a verified solution.

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

AutoNumbers should increment automatically, without duplicates.  But sometimes something goes wrong, and the next AutoNumber value is a duplicate.  This article shows how to recover from this problem.
Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
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.

715 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