Dteremine the day of the week based on date.

R

RAM

I use a calendar control on my schedule form to select dates. I work the
same day in three different office locations each week. I want to have a
text box automatically display my office location based on the day of the
week selected on the calandar control. This will eliminate my office
scheduler from making location mistakes.

Thanks in advance
 
R

ruralguy via AccessMonster.com

So what are you having trouble with? What have you tried so far?
 
A

Al Campagna

Ram,
text box automatically "display"
Given a CalendarControl named for ex. [calMyCalendar]
Add an unbound text control to your form (ex. [OfficeLocation])

You didn't indicate whether calMyCalendar or OfficeLocation are bound
fields. Since you requested "display", I'll assume a "bound" calMyCalendar,
and a "calculated" OfficeLocation.

Give OfficeLocation of ControlSource of... (Checks for Mon, Tues, Wed)

=IIf(Weekday([calMyCalendar].[Value])=2,"MonOffice",IIf(Weekday([calMyCalendar])=3,"TueOffice",IIf(Weekday([calMyCalendar].[Value])=4,"WedOffice","")))
--
hth
Al Campagna
Microsoft Access MVP
http://home.comcast.net/~cccsolutions/index.html

"Find a job that you love... and you'll never work a day in your life."
 
R

ruralguy via AccessMonster.com

Al,
I think the Choose() function would be a better choice for your approach.

Al said:
Ram,
text box automatically "display"
Given a CalendarControl named for ex. [calMyCalendar]
Add an unbound text control to your form (ex. [OfficeLocation])

You didn't indicate whether calMyCalendar or OfficeLocation are bound
fields. Since you requested "display", I'll assume a "bound" calMyCalendar,
and a "calculated" OfficeLocation.

Give OfficeLocation of ControlSource of... (Checks for Mon, Tues, Wed)

=IIf(Weekday([calMyCalendar].[Value])=2,"MonOffice",IIf(Weekday([calMyCalendar])=3,"TueOffice",IIf(Weekday([calMyCalendar].[Value])=4,"WedOffice","")))
I use a calendar control on my schedule form to select dates. I work the
same day in three different office locations each week. I want to have a
[quoted text clipped - 3 lines]
Thanks in advance
 
G

George Nicholson

Other approaches:
Format(CalValue,"dddd")
WeekdayName(Weekday(calValue),False)
 

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