Sync with computer clock

majury221

Registered User.
Local time
Today, 03:18
Joined
Jan 18, 2006
Messages
10
Hi,

My question is...is there any way to get Access to work out the actual day of the week from a date entered into the computer? The reason for this is...I am designing and implimenting a bookings data base for a village hall, and I wish access to automatically store what day of the week it will be on the specified date, in a field called 'Day'. I need this field to produce a report for the week ahead, showing exactly what is in on which day of the week. Is there any way this can be done? Or do the days just have to be typed in manually, i.e. check a calendar and type them in? I would appreciate it if anyone could give me info...on ANY way this can be implimented...be it store the dates in a table or use a giant Iif statement or whatever! And the tags necessary would be helpful,

Thank-you for your help in advance, and i apologise for such a lengthy post!

Please get in touch directly through c.majury@ntlworld.com or alternatively post the answer here.

Chris
 
Don't you dare store the day of the week in your database!
Wherever you have a date, get the weekday on the fly like:
=WeekdayName(Weekday(Date()))
or
WeekdayName(Weekday([MyDateField]))
 
or just set the format of the display to DDDD
 
The formula WeekdayName(Weekday([MyDateField])) works like it should, however it is wrong! It tells me that the 21st January is a Sunday however it is infact a Saturday! Is there any reason this is wrong...and any way it can be fixed?!

Cheers

Chris
 
Last edited:
In VBA:
Me.Text9 = WeekdayName(Weekday(Date), , vbUseSystemDayOfWeek)

I don't know the syntax to specify first day of week in a formula in a text box. Maybe someone else does?
 
Hi-

The default value for First Day of Week is Sunday (1). This works:

? format(weekday(#1/21/06#), "dddd")
Saturday

Finding the first day of a week based on a date within the week:

x = #1/21/06#
fdow = x - Weekday(x) + 1
? fdow
1/15/06


Bob
 

Users who are viewing this thread

Back
Top Bottom