Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms / October 2007

Tip: Looking for answers? Try searching our database.

Calculated Field

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
rogerscmg@gmail.com - 29 Oct 2007 18:25 GMT
Im fairly new to access, and have a quick question.  I have 1 table
with a bunch of fields. of those fields, i have Open and Delivered (as
in a # of open emailed, and # of delivered emails).  Id like to divide
the two fields to find a percentage, and then store that number in a
field called Open Rate, which also resides in the same table.  how can
i SAVE this number to the table?
fredg - 29 Oct 2007 18:45 GMT
> Im fairly new to access, and have a quick question.  I have 1 table
> with a bunch of fields. of those fields, i have Open and Delivered (as
> in a # of open emailed, and # of delivered emails).  Id like to divide
> the two fields to find a percentage, and then store that number in a
> field called Open Rate, which also resides in the same table.  how can
> i SAVE this number to the table?

1)  Open is a reserved Access/VBA/Jet word and should not be used as a
field name.
For additional reserved words, see the Microsoft KnowledgeBase article
for your version of Access:

109312  'Reserved Words in Microsoft Access'  for Access 97
209187  'ACC2000: Reserved Words in Microsoft Access'
286335  'ACC2002: Reserved Words in Microsoft Access'
321266  'ACC2002: Microsoft Jet 4.0 Reserved Words'

For an even more complete list of reserved words, see:
http://www.allenbrowne.com/AppIssueBadWord.html

2)  It's easy enough to find the percentage (after you change the
field name from "Open" to, perhaps "MailOpen".

Using an UNBOUND text control on your form (or in a Report), set it's
control source to:

= [MailOpen]/[Delivered]

If you wish the value actually formatted as % ( i.e. 25% rather than
as a decimal  .25) then set the format property of the control to
percent

3)  There is no reason to save this calculated data in any table. Any
time you need the percentage, simply recalculate it, as above.
Signature

Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail

John W. Vinson - 30 Oct 2007 02:54 GMT
>how can
>i SAVE this number to the table?

Don't.

Storing derived data such as this in your table accomplishes
three things: it wastes disk space; it wastes time (almost
any calculation will be MUCH faster than a disk fetch); and
most importantly, it risks data corruption. If one of the
underlying fields is subsequently edited, you will have data
in your table WHICH IS WRONG, and no automatic way to detect
that fact.

Just redo the calculation whenever you need it, either as a
calculated field in a Query or just as you're now doing it -
in the control source of a Form or a Report textbox.

            John W. Vinson [MVP]
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.