Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Calculation on an MS Access Form and updating table

Status
Not open for further replies.

lmmoorewi

IS-IT--Management
Feb 5, 2009
24
US
I created an MS Access form for emmployees time cards and tasks.

I created a table (Hours) to store all of the entries for each employee. How can I create a calculation on a form and have the data stored in the table?

Form:
Sunday Hours
Monday Hours
Tuesday Hours
Wednesday Hours
Thursday Hours
Friday Hours
Saturday Hours
Total Hours - this is ths field that will sum all of the fields above (Sunday Hours, Monday Hours etc.).

I also want the Total Hours stored in the table I created for the hours.
 
Why do you want to store the total hours when this can always be calculated from the other field values. This is generally considered bad practice.

I would also recommend storing the hours in a normalized table where each hour value is stored in its own record.

Duane
Hook'D on Access
MS Access MVP
 
Hi -

Thanks for responding.

I wanted to store the total hours for reporting purposes. This is not a good idea?

What is a 'normalized table'? Here is what I have created. Each employee's worklog is in a table in it's own record. Then I created an' Hours' table just to store each employee's worklog hours for that week in it's own record. Was this a good idea/best practice?

Thanks for your help.
 
Thanks for the information. Yes, all of my tables are normalized - I just didn't know the meaning.

So.....back to my question.

How can I calculate and store the Sum of the Hours.
 
Immoorewi,

Back to what Dhookom said, you should NEVER put calculated values in a table. I believe that violates the 1st normalization rule. (I could be mistaken on which rule, but it definitely violates it.)

What you COULD do, if you want to store the calculated hours somewhere, is just set up a query...

On the query, you could have all the calculations you want (that's what they're there for.), and then have your form edit, or update the query.

But yea, never ever have calculated values in a table.
 
ooohhh, ok I get it.

I will create a query for those calculations.

Thanks for your help!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top