0

I have a calendar/scheduler that I am coding and I want people to be able to search for the next available date via a few options. One of those options is to only search those dates that are "Monday" for example.

I have the following SQL command to retrieve data from my Access database, but it does not work.

"SELECT * FROM Appointments WHERE TimeAvail=True AND DateName(Weekday,AptDate) = 'Monday'"

or

"SELECT * FROM Appointments WHERE TimeAvail=True AND AptDate.DayOfWeek = 'Monday'"

Neither of these work (kindof as expected), but this is generally the idea that I would like.

I was also thinking of creating another database field and naming that WeekDayName and only searching for WeekDayName=Monday, but was wondering if there is a way of manipulating my SELECT command without making database changes. Any help or suggestions would be greatly appreciated.

3
Contributors
2
Replies
14
Views
4 Years
Discussion Span
Last Post by kRod
0

How about trying this

"SELECT * FROM Appointments WHERE TimeAvail=True AND Format(AptDate,'dddd') = 'Monday';"

Edited by kRod

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.