Set Day Name by Date (1 Viewer)

DaniBoy

Registered User.
Local time
Today, 19:19
Joined
Nov 18, 2001
Messages
175
Hello Guys,

Thank you for all the help you have giving me, I now have a full time job as a database manager and I am desinging some new databases for the Alachua County Waste Collection Office in Gainesville Florida. You guys are the best help I have ever gotten for access. Not even my teacher explains as good as you guys do, and you write it on here, he is face to face!!! Anyway special thanks to Pat. RV, Rich and all that have answered my posts. Now for the quiestion!!!! :)

I want to have a field that will tell me the day of the week "Monday-Sunday" depending on the Date 06/05/2002. How do I do that. Could be in a query.


Thank you
DaniBoy
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 14:19
Joined
Feb 19, 2002
Messages
43,274
I have some sympathy with the question since the help system for Access gets worse with each subsequent version. My personal solution is to keep a copy of A97 installed so that I can use it to get function info. If you don't have A97 help available, then once you have the name of a potentially useful function, you'll need to open a code module and type functionname( to get syntax info since typing the function name in help will provide NO HELP AT ALL - BOO HISS - CURSES ON BILL'S CHILDREN! May they all rot in HELP HELL.

Anyway, you can use either Format() or if using XP, I think there is a WeekDayName() function.

In A97 - look up Format function, then drop down the "see also" menu, choose User Defined Date/Time formats. What you'll find there is:
Code:
[COLOR=crimson]The following table identifies characters you can use to create user-defined date/time formats:

Character	Description
(:)	Time separator. In some locales, other characters may be used to represent the time separator. The time separator separates hours, minutes, and seconds when time values are formatted. The actual character used as the time separator in formatted output is determined by your system settings.
(/)	Date separator. In some locales, other characters may be used to represent the date separator. The date separator separates the day, month, and year when date values are formatted. The actual character used as the date separator in formatted output is determined by your system settings.
c	Display the date as ddddd and display the time as 
ttttt, in that order. Display only date information if there is no fractional part to the date serial number; display only time information if there is no integer portion.
d	Display the day as a number without a leading zero (1_–_31).
dd	Display the day as a number with a leading zero (01_–_31).
ddd	Display the day as an abbreviation (Sun_–_Sat).
dddd	Display the day as a full name (Sunday_–_Saturday).
ddddd	Display the date as a complete date (including day, month, and year), formatted according to your system's short date format setting. For Microsoft Windows, the default short date format is m/d/yy.
dddddd	Display a date serial number as a complete date (including day, month, and year) formatted according to the long date setting recognized by your system. For Microsoft Windows, the default long date format is mmmm dd, yyyy.
w	Display the day of the week as a number (1 for Sunday through 7 for Saturday).
ww	Display the week of the year as a number (1_–_54).
m	Display the month as a number without a leading zero (1_–_12). If m immediately follows h or hh, the minute rather than the month is displayed.
mm	Display the month as a number with a leading zero (01_–_12). If m immediately follows h or hh, the minute rather than the month is displayed.
mmm	Display the month as an abbreviation (Jan_–_Dec).
mmmm	Display the month as a full month name (January_–_December).
q	Display the quarter of the year as a number (1_–_4).
y	Display the day of the year as a number (1_–_366).
yy	Display the year as a 2-digit number (00_–_99).
yyyy	Display the year as a 4-digit number (100_–_9999).
h	Display the hour as a number without leading zeros (0_–_23).
hh	Display the hour as a number with leading zeros (00_–_23).
n	Display the minute as a number without leading zeros (0_–_59).
nn	Display the minute as a number with leading zeros (00_–_59).
s	Display the second as a number without leading zeros (0_–_59).
ss	Display the second as a number with leading zeros (00_–_59).
t t t t t	Display a time as a complete time (including hour, minute, and second), formatted using the time separator defined by the time format recognized by your system. A leading zero is displayed if the leading zero option is selected and the time is before 10:00 A.M. or P.M. For Microsoft Windows, the default time format is h:mm:ss.
AM/PM	Use the 12-hour clock and display an uppercase AM with any hour before noon; display an uppercase PM with any hour between noon and 11:59 P.M.
am/pm	Use the 12-hour clock and display a lowercase AM with any hour before noon; display a lowercase PM with any hour between noon and 11:59 P.M.
A/P	Use the 12-hour clock and display an uppercase A with any hour before noon; display an uppercase P with any hour between noon and 11:59 P.M.
a/p	Use the 12-hour clock and display a lowercase A with any hour before noon; display a lowercase P with any hour between noon and 11:59 P.M.
AMPM	Use the 12-hour clock and display the AM string literal as defined by your system with any hour before noon; display the PM string literal as defined by your system with any hour between noon and 11:59 P.M. AMPM can be either uppercase or lowercase, but the case of the string displayed matches the string as defined by your system settings. For Microsoft Windows, the default format is AM/PM.[/COLOR]
 

DaniBoy

Registered User.
Local time
Today, 19:19
Joined
Nov 18, 2001
Messages
175
Thanks Pat

I am sorry about the question, I tried looking at the windows help and I searched under set day name. I had a mind block from sitting in front of the computer for about 5 hr straight working on this database!!! Once I saw your post, I felt realy stupid!!! Thanks for tracking me back into place!!! jajaja :)

DaniBoy
 
R

Rummy

Guest
This is my first day using Access and I'm going nowhere fast. Please help me understand in the simplest terms, I'm a greenhorn.

I'm creating a form, the first text box is "Date:". In the properties I have the "Control Source" as "=Date()" and it works just fine (at least for today, we'll see about tomorrow :rolleyes: ). It auto-calculates/completes the proper mm/dd/yyyy for me.

Now, I'd like to have a "Day:" text box next. (should it be a text box??) No matter what I try, I can't get it to auto-complete the weekday name as in "Monday" How do I do it?

I'm using Access in Office XP Pro and know nothing of scripting, I'm a firefighter by trade. Many thanks in advance!

-Doug-
 
R

Rich

Guest
just add an unbound textbox to your form, set its control source to =Date(), set the format to DDDD.
seems a strange request though, don't users know what day it is?
 
R

Rummy

Guest
Rich said:
just add an unbound textbox to your form, set its control source to =Date(), set the format to DDDD.
seems a strange request though, don't users know what day it is?

:eek: You don't know how much I appreciate the help! I kept getting "#NAME?" or something like that in the field every time I tried something.

We're firefighters, we only work every third day, its hard to keep track. ;)

Really, THANKS!

-Doug-
 
R

Rummy

Guest
Along the same lines, what can I add to =Date() to allow the date to be edited manually while completing the form? Like when a report is started after midnight but applies to the previous day?
 
R

Rich

Guest
Set the Default entry to =Date() and not the control source, I would suggest that you do not name the field or the control Date, it's a reserved word in Access and will cause problems.
 

Users who are viewing this thread

Top Bottom