Solved

Find all rows based on day of week

Posted on 2011-03-23
5
634 Views
Last Modified: 2012-05-11
I am importing an appointment schedule from an old software into a new one.  I have a situation where I need to seperate out some appointments.  Is there any way I can query the appointments table and say something like this:

SELECT * FROM Appointments WHERE DATE is a Tuesday?

This way I'll get all appointments that were scheduled on a Tuesday.  And I'll need to do the same for other weekdays as well.

NOTE:  I can pull this table into SQL Server 2008 if that makes querying easier.
NOTE:  All dates are in the year 2011.

JamesNT
0
Comment
Question by:JamesNT
5 Comments
 
LVL 119

Expert Comment

by:Rey Obrero
ID: 35198163
in access, you can use

format(Date(),"dddd")="Thursday"

or

weekday(Date())=5

0
 
LVL 3

Expert Comment

by:Thomas_Roes
ID: 35198204
There is a function: (my date-field is called 'dag')

Weekday([dag])

You can filter on this.

Thomas Roes
0
 
LVL 18

Accepted Solution

by:
p912s earned 500 total points
ID: 35198253
Your complete SQL string would be like this.

SELECT * FROM Appointments WHERE ((Weekday([YOURDATEFIELDHERE])="3"));

0
 
LVL 44

Expert Comment

by:GRayL
ID: 35199944
3 above should not be in quotes
0
 
LVL 18

Expert Comment

by:p912s
ID: 35202332
Thanks for the grade and points!
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

Introduction When developing Access applications, often we need to know whether an object exists.  This article presents a quick and reliable routine to determine if an object exists without that object being opened. If you wanted to inspect/ite…
A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.

911 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

22 Experts available now in Live!

Get 1:1 Help Now