PC Review


Reply
Thread Tools Rate Thread

Calculate day of week in form & store in table

 
 
=?Utf-8?B?REdyZWdn?=
Guest
Posts: n/a
 
      30th Oct 2007
I need to calculate day of week based on a report date on a form and have the
data stored in the table. First off, I realize that this may be frowned upon
in that a query could be set up to calculate the day of week on an as needed
basis. This however, is not an option in that it doesn't meet the need for
how the database is to be used. I need to have both the form and table
display/store the day of week (i.e. Sunday).

I created a form in which the report date is entered. So also created a
combo box to capture the day of week in which there are 2 columns; column 1
is the translation (i.e. Sunday) and column 2 is the corresponding number for
day of week (i.e. 1) (Sunday = 1). If I enter weekday([ReportDate]) in the
control source for the combo box the value is returned on the form but is not
stored in the table. The combo box allows the english translation for the
numeric day of week value to be displayed on the form (displays as Sunday
rather than 1). I tried entering the formula (weekday([ReportDate]) in
AfterUpdate for the report date field but the day of week field is not being
updated. What am I doing wrong? Thank you in advance!
 
Reply With Quote
 
 
 
 
John W. Vinson
Guest
Posts: n/a
 
      30th Oct 2007
On Tue, 30 Oct 2007 14:08:01 -0700, DGregg <(E-Mail Removed)>
wrote:

>I need to calculate day of week based on a report date on a form and have the
>data stored in the table. First off, I realize that this may be frowned upon
>in that a query could be set up to calculate the day of week on an as needed
>basis. This however, is not an option in that it doesn't meet the need for
>how the database is to be used. I need to have both the form and table
>display/store the day of week (i.e. Sunday).


Sorry, but no, you DON'T.

You can use a Query to calculate it. You can display this query on a Form; you
can print this query in a Report; you can export this query to an external
file; you can do *ANYTHING* with it which you can do with a table... except
one. The one thing you can't do is edit the day of the week to Sunday if the
date is October 30... but then you really wouldn't want the user to be able to
do that, would you???

If you have users viewing data in tables... well, don't. It's very limited for
the user, and this is just one of many things that you cannot do in a table.

John W. Vinson [MVP]
 
Reply With Quote
 
Douglas J. Steele
Guest
Posts: n/a
 
      30th Oct 2007
I don't see any reason why you need the week day stored in the table.

Create a query with a computed field that gives you the week day, and use
the query wherever you would otherwise have used the table.

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)


"DGregg" <(E-Mail Removed)> wrote in message
news:B18C3C56-C9DE-4B23-AECF-(E-Mail Removed)...
>I need to calculate day of week based on a report date on a form and have
>the
> data stored in the table. First off, I realize that this may be frowned
> upon
> in that a query could be set up to calculate the day of week on an as
> needed
> basis. This however, is not an option in that it doesn't meet the need
> for
> how the database is to be used. I need to have both the form and table
> display/store the day of week (i.e. Sunday).
>
> I created a form in which the report date is entered. So also created a
> combo box to capture the day of week in which there are 2 columns; column
> 1
> is the translation (i.e. Sunday) and column 2 is the corresponding number
> for
> day of week (i.e. 1) (Sunday = 1). If I enter weekday([ReportDate]) in
> the
> control source for the combo box the value is returned on the form but is
> not
> stored in the table. The combo box allows the english translation for the
> numeric day of week value to be displayed on the form (displays as Sunday
> rather than 1). I tried entering the formula (weekday([ReportDate]) in
> AfterUpdate for the report date field but the day of week field is not
> being
> updated. What am I doing wrong? Thank you in advance!



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Calculate tax and store in table =?Utf-8?B?TGluZGE=?= Microsoft Access Forms 4 1st Dec 2008 11:07 AM
Auto calculate day of week to week of the year (not as serial) oftenconfused Microsoft Excel Misc 4 23rd Jun 2008 05:14 PM
RE: Calculate Controls/Store In Table rpw Microsoft Access Database Table Design 0 2nd Apr 2008 06:50 AM
calculate a control and store in table. =?Utf-8?B?a2Fvcw==?= Microsoft Access Forms 3 21st Oct 2007 11:25 PM
Calculate and store future date in a table =?Utf-8?B?amVubmllYmVudGhhbQ==?= Microsoft Access 14 16th Aug 2007 03:10 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:09 PM.