Autofill Day of the Week

B

Bill

How can I create a table with two fields in it. The first field is named
“ddate†and set for “Short Date†as the data type. This will be the primary
key also. So once I enter the date i.e. 09/30/2009 into the “ddate†field.
The next field named “dayoftheweek†and set for “Text†as the data type. I
want this field to autofill with the day of the week i.e. Wednesday. I have
read other posts and tried entering in the second field Format section this
=Format ([ddate],â€ddddâ€) but when I save the table the text I entered
changes. It changes to “=Forâ€mâ€at([“ddâ€ate],dddd). Does anyone know where I
went wrong. This is my first Access project so I am in need of guidance.
Thanks,
Bill
 
W

Wayne-I-M

Hi Bill

You "could" add the name of the day to a field in a table - if you really
wanted - using an update query
But godd idea is not to.
You can add the day to a query, form or report using the
Format([datefield],"dddd")
at any time you want so what is the point is storing this. It's just extra
data that can be created whenever you want.

Also if you add the name of the day a field and then (for some strange
reason) change the date field you would then need to update the name field
using your update query.

best bet is not to store it
 
K

Klatuu

As Wayne said, you should not do that. Carrying calculated data in a table
violates one of the basic rules of database normalization. In this case it
also means you are carrying data in the table that would have no purpose
other than to take up space.

Here is another expression you can use to present the day of the week to
users in forms or reports when needed:

eekdayname(weekday(date))
 
S

Steve Sanford

Here is another expression you can use to present the day of the week to
users in forms or reports when needed:

eekdayname(weekday(date))
--


Dave,

I can't scare up any info in Help about that function.

Is it in the special "Halloween.dll" :D
 
K

Klatuu

Now that is funny.
Name should be weekdayname

Totally amazing because I never make mistrakes.
 
B

Bill

I want to thanks everyone for the help. Sorry it took me so long to reply
back, but time didnot allow it till now. Anyway like I said I'm new to Access
so I had to rethink my table structure. I will be posting again with more
questions, I hope you can help me then.
Thanks,
Bill
 
K

Klatuu

Never be shy about asking questions in these groups. It is about the best
resource there is for qetting specific answers to questions as well as
guidance on design and best practices.
--
Dave Hargis, Microsoft Access MVP


Bill said:
I want to thanks everyone for the help. Sorry it took me so long to reply
back, but time didnot allow it till now. Anyway like I said I'm new to Access
so I had to rethink my table structure. I will be posting again with more
questions, I hope you can help me then.
Thanks,
Bill

Bill said:
How can I create a table with two fields in it. The first field is named
“ddate†and set for “Short Date†as the data type. This will be the primary
key also. So once I enter the date i.e. 09/30/2009 into the “ddate†field.
The next field named “dayoftheweek†and set for “Text†as the data type. I
want this field to autofill with the day of the week i.e. Wednesday. I have
read other posts and tried entering in the second field Format section this
=Format ([ddate],â€ddddâ€) but when I save the table the text I entered
changes. It changes to “=Forâ€mâ€at([“ddâ€ate],dddd). Does anyone know where I
went wrong. This is my first Access project so I am in need of guidance.
Thanks,
Bill
 

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