Translate Tuesday to WeekdayNumber?

H

Henro

How can I translate the name of the day (e.g. Tuesday) to a weekdaynumber
(e.g. 3)?
Weekday and WeekdayName seem to do the opposite :-(

TIA Henro
 
D

Douglas J. Steele

I don't believe there's anything built into Access that will do that
translation, so you'll probably have to write your own function to do it.

Why, though, do you need this capability? If you know the complete date,
Weekday([TheDate]) will give you the weekday number.
 
H

Henro

I have a list of engineers. They have one day off each week, this is a fixed
day (in my case Tuesday)
This day is noted in the table with it's full name (e.g. Tuesday)
I have built some kind of calendar in Access and I want the field
DayDescription to be filled automatically with "DayOff" if that particular
day is the Day off for that Engineer. So in human language:

If Engineer is Henro and Day in Calendar is Tuesday then Fill DayDescription
with "DayOff" and that check has to be done on every day in the calendar
(400 days starting from 1-1-2004)


Henro





Douglas J. Steele said:
I don't believe there's anything built into Access that will do that
translation, so you'll probably have to write your own function to do it.

Why, though, do you need this capability? If you know the complete date,
Weekday([TheDate]) will give you the weekday number.

--
Doug Steele, Microsoft Access MVP

(No private e-mails, please)



Henro said:
How can I translate the name of the day (e.g. Tuesday) to a weekdaynumber
(e.g. 3)?
Weekday and WeekdayName seem to do the opposite :-(

TIA Henro
 
D

Douglas J. Steele

You could loop through the first week of the calendar, comparing
Format([CalendarDay], "dddd") to the stored DayOff. Once you've identified
the date of the first day off, subsequent ones would be that date a week
later (i.e. DateAdd("d", 7, [CalendarDay]) or DateAdd("ww", 1,
[CalendarDay])). Or have I misinterpretted what you're trying to do?

--
Doug Steele, Microsoft Access MVP

(No private e-mails, please)



Henro said:
I have a list of engineers. They have one day off each week, this is a fixed
day (in my case Tuesday)
This day is noted in the table with it's full name (e.g. Tuesday)
I have built some kind of calendar in Access and I want the field
DayDescription to be filled automatically with "DayOff" if that particular
day is the Day off for that Engineer. So in human language:

If Engineer is Henro and Day in Calendar is Tuesday then Fill DayDescription
with "DayOff" and that check has to be done on every day in the calendar
(400 days starting from 1-1-2004)


Henro





Douglas J. Steele said:
I don't believe there's anything built into Access that will do that
translation, so you'll probably have to write your own function to do it.

Why, though, do you need this capability? If you know the complete date,
Weekday([TheDate]) will give you the weekday number.

--
Doug Steele, Microsoft Access MVP

(No private e-mails, please)



Henro said:
How can I translate the name of the day (e.g. Tuesday) to a weekdaynumber
(e.g. 3)?
Weekday and WeekdayName seem to do the opposite :-(

TIA Henro
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top