Hi Bob,
I've set up a table with the following fields:
Emp#, Name, AnnualSalary, MonthlySalary, LTDBenefit
It is best to avoid the use of special characters and reserved words,
including the # sign, spaces, etc. in anything that you assign a name to
within Access:
Special characters that you must avoid when you work with Access databases
http://support.microsoft.com/?id=826763
Also, "Name" is considered a reserved word. You should avoid using any
reserved
words when assigning names to anything in Access (fields, tables, queries,
forms, reports, macros, modules, variables, controls on forms & reports,
etc.). Access MVP Allen Browne maintains an extensive list of reserved words
here:
Problem names and reserved words in Access
http://allenbrowne.com/AppIssueBadWord.html
He also offers a free utility, called the "Database Issue Checker Utility".
This is a .mdb file, which you can use to check your existing Access
databases for reserved words.
Notes:
It covers fields, tables and queries only (not controls, variable names, etc.)
Your database should be closed when using this utility to test your database.
In general, you do not want to store values in tables that can be
calculated. Doing so violates normalization rules of database design. In some
cases, people will store values that can be calculated to help with
performance issues, but this is best done in a database that supports
triggers, so that if one of the values is changed, the calculated value will
be automatically updated. Check out the two database design papers written by
Michael Hernandez, here:
http://www.accessmvp.com/JConrad/accessjunkie/resources.html#DatabaseDesign101
(See the first download titled "Understanding Normalization")
<Begin Quote (from page 23 of document)>
"The most important point for you to remember is that you will always
re-introduce data integrity problems when you de-Normalize your structures!
This means that it becomes incumbent upon you or the user to deal with this
issue. Either way, it imposes an unnecessary burden upon the both of you.
De-Normalization is one issue that you'll have to weigh and decide for
yourself whether the perceived benefits are worth the extra effort it will
take to maintain the database properly."
<End Quote>
As fellow Access MVP John Vinson likes to say "Storing calculated data
generally accomplishes only three things: it wastes disk space, it wastes
time (a disk fetch is much slower than almost any reasonable calculation),
and it risks data validity, since once it's stored in a table either the
Total or one of the fields that goes into the total may be changed, making
the value WRONG."
Tom Wickerath
Microsoft Access MVP
http://www.accessmvp.com/TWickerath/
__________________________________________
Bob76 said:
I've set up a table with the following fields:
Emp#, Name, AnnualSalary, MonthlySalary, LTDBenefit
I have a value for AnnualSalary..I would like to have the following
calcualted fields:
MonthlySalary = AnnualSalary/12 and
LTDBenefit = AnnualSalary*0.667
i read in a book about using Expression builder to do this..I tried to put
this in the designView under the field's Validation Rule, as such:
=[AnnualSalary]/12
but i keep on getting a syntax error... What is wrong? How/where should i do
this calculation?
Thanks, Bob76