Auto sum / total 2 fields in a record

Auto sum 2 fields in a record
Hi. This is incredibly easy to do in Excel but I’m afraid it’s eluding and 
frustrating me in Access!!!   I have a very simple table with 5 columns 
formatted to collect money amounts.  So, the User would enter the 5 money 
amounts into each record.  So far so good….

The first 2 fields in each record collect “Income from farm”, the second 
field collects “Income from shop”.  I’d like a 3rd field to automatically add 
up the content of what’s been entered in the first 2 fields (the 3rd field 
should never accept user input directly) and display that result in the 
record so the User can easily see the result.  There are other subsequent 
fields in the record that would continue to accept manually entered money 
amounts.  I’ve researched this a little and the solutions become incredibly 
complicated and often talk about Queries and or linking to Excel 
(ironically!!).  I’m hoping for a very simple solution to a very simple 
problem. Hope you can help

-- 
Peter
0
Utf
3/9/2010 6:24:07 PM
access.forms 6864 articles. 2 followers. Follow

4 Replies
6875 Views

Similar Articles

[PageSpeed] 28

Peter,

In my opinion, you do not actually want to store that sum in the
table.  Storing values that are calculations based on other fields can
cause numerous issues.  For example, if someone updates the "Income
from farm", your sum field would NOT automatically update. It becomes
very easy to get bad data.  In Excel it doesn't matter, since you
actually storing a formula in a cell, but databases do not work like
that.

That being said, you can still display this sum on forms / reports /
queries whenever you would like to.  You can have an unbound textbox
on a form that is set to be the sum of the 2 values, and similarly
setup controls in reports/queries to show the sum.

i.e. for a textbox you can set the Control Source to something similar
to: =[Income from Farm] + [Income from shop]


hope that make sense.
0
ghetto_banjo
3/9/2010 7:07:37 PM
On Tue, 9 Mar 2010 10:24:07 -0800, Peter <peter@discussions.microsoft.com>
wrote:

>Auto sum 2 fields in a record
>Hi. This is incredibly easy to do in Excel but I�m afraid it�s eluding and 
>frustrating me in Access!!!   I have a very simple table with 5 columns 
>formatted to collect money amounts.  So, the User would enter the 5 money 
>amounts into each record.  So far so good�.
>
>The first 2 fields in each record collect �Income from farm�, the second 
>field collects �Income from shop�.  I�d like a 3rd field to automatically add 
>up the content of what�s been entered in the first 2 fields (the 3rd field 
>should never accept user input directly) and display that result in the 
>record so the User can easily see the result.  There are other subsequent 
>fields in the record that would continue to accept manually entered money 
>amounts.  I�ve researched this a little and the solutions become incredibly 
>complicated and often talk about Queries and or linking to Excel 
>(ironically!!).  I�m hoping for a very simple solution to a very simple 
>problem. Hope you can help

Excel is a spreadsheet, best of breed.
Access is a relational database programming environment.

THEY ARE DIFFERENT!!!!!

A table may look like a spreadsheet but it emphatically is NOT. The sum should
be calculated dynamically, on the fly, *in a Query*, or in the control source
of a form or report textbox. It should simply not exist in your table.

For that matter, if you are storing two kinds of income... someday might you
need three? or four? "Income from computer software business", "Income from
farm implement repairs"...? Sure, in a spreadsheet you would just add more
columns; but in a relational database you would have a *second table*, with
one row per income stream.

Access is very capable of doing what you want, but NOT in the way that you're
trying to do it!

Stop trying to use Access as if it were "Excel on Steroids", because that will
just lead to vast frustration. Instead, do a little study on "normalization"
and "relational database design", and work *with* Access instead of struggling
against it. Here are some resources to help you do so.

Jeff Conrad's resources page:
http://www.accessmvp.com/JConrad/accessjunkie/resources.html

The Access Web resources page:
http://www.mvps.org/access/resources/index.html

Roger Carlson's tutorials, samples and tips:
http://www.rogersaccesslibrary.com/

A free tutorial written by Crystal:
http://allenbrowne.com/casu-22.html

A video how-to series by Crystal:
http://www.YouTube.com/user/LearnAccessByCrystal

MVP Allen Browne's tutorials:
http://allenbrowne.com/links.html#Tutorials

-- 

             John W. Vinson [MVP]
0
John
3/9/2010 9:34:48 PM
Wow! I can't thank you enough.  I've taken your comments on board AND 
implemented the function - no surprise to you that it works.  You've made me 
very happy and more educated.
Very many thanks indeed.
-- 
Peter


"ghetto_banjo" wrote:

> Peter,
> 
> In my opinion, you do not actually want to store that sum in the
> table.  Storing values that are calculations based on other fields can
> cause numerous issues.  For example, if someone updates the "Income
> from farm", your sum field would NOT automatically update. It becomes
> very easy to get bad data.  In Excel it doesn't matter, since you
> actually storing a formula in a cell, but databases do not work like
> that.
> 
> That being said, you can still display this sum on forms / reports /
> queries whenever you would like to.  You can have an unbound textbox
> on a form that is set to be the sum of the 2 values, and similarly
> setup controls in reports/queries to show the sum.
> 
> i.e. for a textbox you can set the Control Source to something similar
> to: =[Income from Farm] + [Income from shop]
> 
> 
> hope that make sense.
> .
> 
0
Utf
3/9/2010 10:15:01 PM
Hello John.  Yes, I’d forgotten my roots!! Too long ago to remember when 
doing my Computer Science degree I once understood normalisation, DB design 
etc…. since then in the real World I forgot the basics and used Excel – 
perhaps too much.  I do need to break the link and study again.
Thanks for the injection of realism – seriously appreciated.
-- 
Peter


"John W. Vinson" wrote:

> On Tue, 9 Mar 2010 10:24:07 -0800, Peter <peter@discussions.microsoft.com>
> wrote:
> 
> >Auto sum 2 fields in a record
> >Hi. This is incredibly easy to do in Excel but I’m afraid it’s eluding and 
> >frustrating me in Access!!!   I have a very simple table with 5 columns 
> >formatted to collect money amounts.  So, the User would enter the 5 money 
> >amounts into each record.  So far so good….
> >
> >The first 2 fields in each record collect “Income from farm”, the second 
> >field collects “Income from shop”.  I’d like a 3rd field to automatically add 
> >up the content of what’s been entered in the first 2 fields (the 3rd field 
> >should never accept user input directly) and display that result in the 
> >record so the User can easily see the result.  There are other subsequent 
> >fields in the record that would continue to accept manually entered money 
> >amounts.  I’ve researched this a little and the solutions become incredibly 
> >complicated and often talk about Queries and or linking to Excel 
> >(ironically!!).  I’m hoping for a very simple solution to a very simple 
> >problem. Hope you can help
> 
> Excel is a spreadsheet, best of breed.
> Access is a relational database programming environment.
> 
> THEY ARE DIFFERENT!!!!!
> 
> A table may look like a spreadsheet but it emphatically is NOT. The sum should
> be calculated dynamically, on the fly, *in a Query*, or in the control source
> of a form or report textbox. It should simply not exist in your table.
> 
> For that matter, if you are storing two kinds of income... someday might you
> need three? or four? "Income from computer software business", "Income from
> farm implement repairs"...? Sure, in a spreadsheet you would just add more
> columns; but in a relational database you would have a *second table*, with
> one row per income stream.
> 
> Access is very capable of doing what you want, but NOT in the way that you're
> trying to do it!
> 
> Stop trying to use Access as if it were "Excel on Steroids", because that will
> just lead to vast frustration. Instead, do a little study on "normalization"
> and "relational database design", and work *with* Access instead of struggling
> against it. Here are some resources to help you do so.
> 
> Jeff Conrad's resources page:
> http://www.accessmvp.com/JConrad/accessjunkie/resources.html
> 
> The Access Web resources page:
> http://www.mvps.org/access/resources/index.html
> 
> Roger Carlson's tutorials, samples and tips:
> http://www.rogersaccesslibrary.com/
> 
> A free tutorial written by Crystal:
> http://allenbrowne.com/casu-22.html
> 
> A video how-to series by Crystal:
> http://www.YouTube.com/user/LearnAccessByCrystal
> 
> MVP Allen Browne's tutorials:
> http://allenbrowne.com/links.html#Tutorials
> 
> -- 
> 
>              John W. Vinson [MVP]
> .
> 
0
Utf
3/21/2010 12:43:02 AM
Reply:

Similar Artilces:

Creating linked fields
How can I create a linked field eg I have Account no in General tab and I create another tab which requires the same Account no to be present basically its the same field in the database so in the tabs it projects the same data ! when typed in the General tab ! It is not possible to have the same field displayed on more than one tab with the current version of the product. I am not sure if it is going to be possible to do this in V2. Anyone know? Guy. "Rick" <Rick@discussions.microsoft.com> wrote in message news:D7EE8552-C4F2-4143-A4C6-B9268C4CF4C9@microsoft.com... &g...

Auto Filter problem
I am using the auto filter for a particular column to sort out differen medical programs. When I click the drop down and click a program, i doesnt show me ALL the lines that say this particular program. Why is this? -- Message posted from http://www.ExcelForum.com Hi maybe some hidden characters in these lines 8e.g. additional space characters, etc.) -- Regards Frank Kabel Frankfurt, Germany "jkb724 >" <<jkb724.19rasx@excelforum-nospam.com> schrieb im Newsbeitrag news:jkb724.19rasx@excelforum-nospam.com... > I am using the auto filter for a particular column to so...

Sum based on multiple conditions
I have Column A with a "stage" in it that will range from 1 - 8 I have column B with a "close date" in it that could be any date I have column C with a value in it. I need the sum of the values in C that have Close dates in any given range (ex. 10/1/2004 through 10/31/2004), that are in any given sales stage. I tried using SUMIF which seems to only work with 1 condition...so I can do =SUMIF(AA,1,CC) and it will give me the sum of the values that are in stage 1. SUMIF doesn't appear to work with ranges or multiple conditions though. =SUMPRODUCT((C1:C100>="...

Populate a cell if values in cell 1 and cell 2 match cell 3 and 4
I need help with a formula please. I need to search through a column of data and populate a cell if it meets a condition. For example: IF FirstWorksheet!A2 = SecondWorksheet!ColumnAx and FirstWorksheet!B2 = SecondWorksheet!ColumnBx Then populate SecondWorksheet!Cx with value from FirstWorksheet!C2 I have to match up a column of data in one worksheet with data in 2 columns in another worksheet. Help plz. Thanks T- A multi-criteria index n match (array-entered) should work here In Sheet2, Copy n paste this into C2's formula bar, then array-enter the formula by pressing CTRL+...

Auto-Editing
Word 2003 has a very annoying default. It assumes too much! If I reformat a few words in a document, it changes the entire document to that formatting. Grr-rrr-r! I have to constantly press undo to get what I want. I know there's a feature that's causing this annoyance but I can't find it to turn it off! Can anyone help, please? See http://word.mvps.org/faqs/formatting/wholedocumentreformatted.htm. -- Stefan Blom Microsoft Word MVP "Connie Martin" <ConnieMartin@discussions.microsoft.com> wrote in message news:CD959D82-F81B-4A9D-993E-73...

CHeaderCtrl #2
MFC is just the thing for me it seems, plently of vexation to while away the hours. *sigh* I am trying to inser a bitmap in the fourth column of my header control, attached to a list ctrl. After reading the docs and codeproject resources, here's what I came up with: void MyViewClass::OnInitialUpdate() { [creation code for List Ctrl, "List"] ..... CHeaderCtrl* pHead = List.GetHeaderCtrl(); CBitmap bm; bm.LoadBitmap(IDB_BITMAP3); HDITEM hdi; pHead->GetItem(4,&hdi); hdi.mask |=HDI_BITMAP|HDI_FORMAT; hdi.fmt |=HDF_BITMAP; hdi.fmt &=~HDF_STRING; ...

Windows 2000 GP installation #2
GP 9.0 Fully Patched/Updated Windows 2000NT console. When installing the integration manager this error pops up when copying files: " The windows installer service cannot update the system file C: \WINNT\system 32\msscript.ocx because the file is protected by windows. You may need to update your operating system for this program to work properly. " Clicking okay resumes the install and everything seems to proceed just fine. When running MS Dynamics GP a login and server can be selected but when you attempt to login to a company we get "The databse setup has not been co...

Auto-Calculate
I have a spreadsheet that utilize the stock quote add-in from MSN. On a daily basis I refresh the add-in functions for the Highs, Lows, Last, Volume, etc. On occasion the spreadsheet reverts to manual caculation settings, and I have to press the F9 even after I updated the quotes. I've always preferred the any spreadsheets I open, blank or otherwise, the automatic setting selected for calculations. I consider this an annoyance. Has anyone experienced this glitch? Is there a fix for it? Ron_D Ron Excel takes the calculation mode from the first workbook that opens in a session. Sub...

addresslists and cantacts #2
Yes, I mean custom recipients. We need to configure our envirement so that every user can view the 25 k contacts in a addressbook. Is there any disadvantage, if I add 25k objekts to the active directory? Could it become slowly or so? Wy should I favorite the active directory integrated method? I could also create all contacts in a public folder? Whats the crucial differnce between the two ways? Thanks for your answer! :-) ...

auto copy self
How do I arrange for Outlook to automatically copy myself on every new, reply or forward email? If you mean keep a copy of all sent, see settings under Tools/Options/Email Options and Advanced Options David "rich" <steamuk@aol.com> wrote in message news:055c01c3664f$dadecd30$a001280a@phx.gbl... > How do I arrange for Outlook to automatically copy myself > on every new, reply or forward email? ...

Auto Scale Chart Macro -- Any improvements please?
This is the best way I've found to correctly scale a chart -- the only way I found to exclude a chart interpolating with #NA cells was to delete those cells containing #NA, and run the chart. This takes a long time on my computer. Wondering if there is a better way. This macro is directly taken from 2 excel mvps and modified; i believe a mehta and ron bovarty, but could be wrong. Thanks for taking a look. Sub AutoScaleYAxes() Dim ValuesArray(), SeriesValues As Variant Dim Ctr As Integer, TotCtr As Integer Application.Run "Extend_Stock_Data" Applic...

Auto correct or Auto complete
We are all familiar witht he auto correct or auto complete functions found in MS applications. Of course that means it is available in Access also. My question is this ... can this function be replicated within the DB, so that the set of auto correct items are part of the package rather than something that would have to be set up on each individual desktop system? It's use, for me, would primarily be within a memo field where medical abreviations, used as a shortcut, would convert to the true meaning as the user types them in. Ex: "prn" without quotes would change to. &qu...

OWA auto login
I am trying to use the credentials from the forms authentication login to automaticaly log in to Outlook Web. I redirect to a URL with this format: http://UserName:Password@mailserver/exchange I have seen this example in other posts but this does not work for me. I still get the Outlook Windows Login prompt. Perry Perecli Manole wrote: > I am trying to use the credentials from the forms authentication > login to automaticaly log in to Outlook Web. I redirect to a URL with > this format: http://UserName:Password@mailserver/exchange > I have seen this example in other posts but t...

2 X 2 Splitter Windows #2
What is wrong with the following code? I am trying to create a 2 X 2 splitter window. It should look like this. CMyTreeView | CMyListView __________________|___________________ | CPictureView | CDetailView It compiles correctly but when I run it I get an error in the WinSplit routine of MFC. if(!m_wndSplitterWnd1.CreateStatic(this,1,2)) return FALSE; if(!m_wndSplitterWnd1.CreateView(0,0, RUNTIME_CLASS(CMyTreeView), CSize(0,0), pContext)) return FALSE; if(!m_wndSplitterWnd2.CreateStatic(&m_wn...

Any way to get rid of an auto-suggestion in the login dialog box, for Exchange/OL using RPC over HTTP?
A client was using RPC over HTTP to two different Exchange servers (OL prompting for profile on startup). Both profiles were set up to prompt for credentials upon connection to Exchange. There's now only one Outlook profile needed; the other is gone and OL isn't prompting for the profile selection any longer, which is fine. However, Outlook is remembering domain1\user and domain2\user in the login dialog box, and I'd love to be able to get rid of the no-longer-valid credential dropdown suggestion. (The computer is not a member of a domain and hence always needs to be prom...

Exchange 2007 Beta 2 question
Hi I have the mailbox, CA, hub and UM on one server. I am trying to create a new email life cycle policy, but the option to do this cannot be found. I right click on the mailbox icon in EMC under "organization" but the option is not listed. The only listed options are. Also the tab in ESM for this is not there New address list New managed custom folder new managed fodler mailbox policy new offline address list On Wed, 23 Aug 2006 13:58:02 -0700, skip <skip@discussions.microsoft.com> wrote: >Hi > >I have the mailbox, CA, hub and UM on one server. I am trying to...

Auto look through subfolders
Please help. I can write a macro that will extract data from all excel files in a specific folder. What I need to be able to do is write a macro that will automatically extract data from excel files within folders and sub folders and sub sub folders etc For example the data is all held on the following directory: H:\development forms\2006 cost sheets\ And within that directory by customer - for example Tesco, Boots, Asda etc. These customers are then subdivided into product ranges - eg 1,2,3,4 etc and some futher subdivided by national or exclusive. All the excel files are in exactly th...

remove macro #2
Hi every time I start an excel workbook I have made I get the security warning about running macros but as far as I can tell there are no macros in the workbook. When I go to tools/macro there are no macros visible in the box that appears. So what is causing the security message to appear? And how can I stop it? If I set the security level to low the message does not appear. Windows XP Pro SP2 and Office 2003 Thanks Ron Press ALT+F11 to open the VBA editor. Delete any text in any of the modules under "Microsoft Excel Object" and delete any modules under "Modules"...

Auto date
I am trying to create a field in a form that if anything is changed on it, it will automatically update the date to current date. Is this possible? Sojaminc wrote: >I am trying to create a field in a form that if anything is changed on it, it >will automatically update the date to current date. Is this possible? Make sure the last changed date/time field is in the form's record source table/query. Then use the form's BeforeUpdate event: Me.lastchanged = Now -- Marsh MVP [MS Access] Hi - You can do this in the On Dirty event of the form, which fires as soon as you m...

An auto reply to an auto reply!
Had the funniest situation yesterday. Somebody emailed a public folder we have set up. On there we have a rule to send a reply saying thanks for your email -someone will be with you shortly (we have to have this message on - it is for some website that recently went live). Now that auto reply went back to the guy who emailed - who must have sent it from a public folder himself (as he forwarded the original email from a public folder). The guy received our auto reply - and promptly his email system sent an auto reply to us. As is the way it is set up - our email system sent him an auto ...

Auto-Alphabetize
I have a master data sheet, with columns of different information. I'd like to pull information from 3 different columns (Rank,LastName,Shift) into a separate column (I know how to do this). What I would then like to have happen is, in another separate column, have the information sorted alphabetically by last name. There are duplicate last names, in which case I'd like them sorted in rank order. Is this at all possible? Also, I can't use a VB Macro - it needs to be in a formula or array format. Rank.......LastName.........Shift PO Smith B/1 ...

Include field not in table in report?
I'm writing a set of tables and forms and reports to manage a small chess club at my daughter's school. One of the things I create is a report on the previous chess match, with the players as drawn and their match results. I extract this from my Games table. The Games table has a foreign key to the Matches table where I have a record recording the Match data (title, date, time, etc.) When I create the Game Results report, I'd like to include the title of the match and it's date in the header. I created a text box and inserted the following expression: =(SELECT [Title] FRO...

Extracting milliseconds from a time field
I have column A with timestamps in format hh:mm:ss.000 - eg 14:32:05.679 and I want to display the milliseconds component of the timestamp, eg in this case 679 in cell B. How can I achieve this? Put this in B1: =3DMOD(A1*24*60*60,1)*1000 and copy down as required. Hope this helps. Pete On Mar 6, 4:06=A0pm, Angus <anguscom...@gmail.com> wrote: > I have column A with timestamps in format hh:mm:ss.000 - eg > 14:32:05.679 and I want to display the milliseconds component of the > timestamp, eg in this case 679 in cell B. =A0How can I achieve this? On Fri, 6 Mar 2009 08:06:01...

How do I auto-reply incoming eMails ?
During my holidays I want to inform the sender of incoming eMails that I am currently not in office. How can I setup an auto-reply note? Do I setup this in my Outlook 2003 or in the Exchange Server? Joe If you connect to an Exchange server at work, use the Out of Office function (under tools). It will reply once to each sender that you are out of the office. By default in Exchange, auto-replies to the internet are turned off so only internal addresses would receive the Out of Office reply but verify with your Exchange Admin how they have the server configured. If you have a POP3 acc...

Multi user #2
is it possible to use an excel spreadsheet as a multi user sheet.i.e. is ther any way to be able to access the sheet by multi user on different computers that are networked and to be able to make changes to the sheeet. -- Lins ------------------------------------------------------------------------ Lins's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=24223 View this thread: http://www.excelforum.com/showthread.php?threadid=393548 See this article for how it's done and the ramifications of it, Lins: http://www.officearticles.com/excel/workbook_sharing_in_...