Solved

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

Posted on 2009-07-14
3
258 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
Comment Utility
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
Comment Utility
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
Comment Utility
perfect...thanks
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
How to Unravel a Tricky Query Introduction If you browse through the Oracle zones or any of the other database-related zones you'll come across some complicated solutions and sometimes you'll just have to wonder how anyone came up with them.  …
Via a live example, show how to restore a database from backup after a simulated disk failure using RMAN.
This video explains what a user managed backup is and shows how to take one, providing a couple of simple example scripts.

762 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

10 Experts available now in Live!

Get 1:1 Help Now