Calculate field with input from different table

Hi all,

I would like to calculate a value of a field in table A via a formula.
However, some input for this formula contains a field in table B.

To put differently, in table A I would like to set the data type of
one field to "calculated" and use a field from table B within the
formula. Unfortunately, Access 2007 only offers me all the fields
within table A for incorporation in my formula. How can I use a field
from a different table for a calculated field in another table?

Best,
Andreas
1
Andreas
12/9/2009 9:27:22 PM
access 16762 articles. 3 followers. Follow

5 Replies
12638 Views

Similar Articles

[PageSpeed] 2

On Wed, 9 Dec 2009 13:27:22 -0800 (PST), Andreas
<andreas.vester@gmail.com> wrote:

>I would like to calculate a value of a field in table A via a formula.
>However, some input for this formula contains a field in table B.
>
>To put differently, in table A I would like to set the data type of
>one field to "calculated" and use a field from table B within the
>formula. Unfortunately, Access 2007 only offers me all the fields
>within table A for incorporation in my formula. How can I use a field
>from a different table for a calculated field in another table?

You can't do this directly in the table.

You can join the tables together in a query and calculate it there.
That's a more normalized approach anyway - you usually don't want to
store a calculated value.

Armen Stein
Microsoft Access MVP
www.JStreetTech.com
 
0
Armen
12/9/2009 9:53:42 PM
Andreas

Are you saying that you wish to use data you already have in tables in 
Access, do some calculations, and store that calculated value (redundantly) 
in a table in Access?  If so, why?  It is rarely necessary to store 
calculated values.

Instead, if you need the calculated value, use a query and do the 
calculation there, in real time.  That way, if any of the underlying data 
changes, your query always has the correct value.

If you believe you have one of the relatively rare situations in which 
storing a calculated value is appropriate, you'll need to provide us more 
specific descriptions so we can offer more specific suggestions.

Regards

Jeff Boyce
Microsoft Access MVP

-- 
Disclaimer: This author may have received products and services mentioned
in this post. Mention and/or description of a product or service herein
does not constitute endorsement thereof.

Any code or pseudocode included in this post is offered "as is", with no
guarantee as to suitability.

You can thank the FTC of the USA for making this disclaimer
possible/necessary.

"Andreas" <andreas.vester@gmail.com> wrote in message 
news:a36b4e4f-5ecf-4cb2-ae13-a699a84a0069@j14g2000yqm.googlegroups.com...
> Hi all,
>
> I would like to calculate a value of a field in table A via a formula.
> However, some input for this formula contains a field in table B.
>
> To put differently, in table A I would like to set the data type of
> one field to "calculated" and use a field from table B within the
> formula. Unfortunately, Access 2007 only offers me all the fields
> within table A for incorporation in my formula. How can I use a field
> from a different table for a calculated field in another table?
>
> Best,
> Andreas 


0
Jeff
12/9/2009 11:19:10 PM
"Andreas" <andreas.vester@gmail.com> wrote in message 
news:a36b4e4f-5ecf-4cb2-ae13-a699a84a0069@j14g2000yqm.googlegroups.com...
> Hi all,
>
> I would like to calculate a value of a field in table A via a formula.
> However, some input for this formula contains a field in table B.
>
> To put differently, in table A I would like to set the data type of
> one field to "calculated" and use a field from table B within the
> formula. Unfortunately, Access 2007 only offers me all the fields
> within table A for incorporation in my formula. How can I use a field
> from a different table for a calculated field in another table?
>
> Best,
> Andreas 

0
Gerald
12/10/2009 8:24:25 AM
On 10 Dez., 00:19, "Jeff Boyce" <nonse...@nonsense.com> wrote:
> Andreas
>
> Are you saying that you wish to use data you already have in tables in
> Access, do some calculations, and store that calculated value (redundantl=
y)
> in a table in Access? =A0If so, why? =A0It is rarely necessary to store
> calculated values.
>
> Instead, if you need the calculated value, use a query and do the
> calculation there, in real time. =A0That way, if any of the underlying da=
ta
> changes, your query always has the correct value.
>
> If you believe you have one of the relatively rare situations in which
> storing a calculated value is appropriate, you'll need to provide us more
> specific descriptions so we can offer more specific suggestions.

Well, I am not exactly sure how I should approach my problem. I am
developing a database in order to store and evaluate my stock trades.
I would like to set up an ID for each trade. The ID should contain
different values, such as the underlying security (e.g. stock, option
etc), the trade date, the stock ticker and entry level in order to
create an individual ID. I would like to have the ID this way, so that
I can use this ID value in order to save a JPG chart under this
particular name. This helps me to bring some order in all my JPG-
charts.

My concrete problem is that the following: Within the trade record, I
just enter the ISIN for a specific intstrument (via a lookup field)
that I traded. Related information for this ISIN (e.g. such as
underlying security) are stored in a different table. Now, I would
need this information in order to create the ID appriately. I am not
sure what other possibilities I have in order to create a meaningful
trade ID. Any suggestions are welcome.

Best,
Andreas
0
Andreas
12/12/2009 12:49:18 PM
Actually, you do NOT want to create that kind of "intelligent" ID.  Trying 
to stuff multiple facts into one field is not good database design, not to 
mention the difficulty of keeping a calculated field "in sync" with all of 
the fields that make it up.

Instead, a simple solution...  Use one field for each fact (good database 
design), then use a query to concatenate which ever fields you want.  That 
will give you a way to "name" your charts...

Good luck!

Regards

Jeff Boyce
Microsoft Access MVP

-- 
Disclaimer: This author may have received products and services mentioned
in this post. Mention and/or description of a product or service herein
does not constitute endorsement thereof.

Any code or pseudocode included in this post is offered "as is", with no
guarantee as to suitability.

You can thank the FTC of the USA for making this disclaimer
possible/necessary.

"Andreas" <andreas.vester@gmail.com> wrote in message 
news:24ac25fd-0d4f-419e-90bf-526916f53475@d10g2000yqh.googlegroups.com...
On 10 Dez., 00:19, "Jeff Boyce" <nonse...@nonsense.com> wrote:
> Andreas
>
> Are you saying that you wish to use data you already have in tables in
> Access, do some calculations, and store that calculated value 
> (redundantly)
> in a table in Access? If so, why? It is rarely necessary to store
> calculated values.
>
> Instead, if you need the calculated value, use a query and do the
> calculation there, in real time. That way, if any of the underlying data
> changes, your query always has the correct value.
>
> If you believe you have one of the relatively rare situations in which
> storing a calculated value is appropriate, you'll need to provide us more
> specific descriptions so we can offer more specific suggestions.

Well, I am not exactly sure how I should approach my problem. I am
developing a database in order to store and evaluate my stock trades.
I would like to set up an ID for each trade. The ID should contain
different values, such as the underlying security (e.g. stock, option
etc), the trade date, the stock ticker and entry level in order to
create an individual ID. I would like to have the ID this way, so that
I can use this ID value in order to save a JPG chart under this
particular name. This helps me to bring some order in all my JPG-
charts.

My concrete problem is that the following: Within the trade record, I
just enter the ISIN for a specific intstrument (via a lookup field)
that I traded. Related information for this ISIN (e.g. such as
underlying security) are stored in a different table. Now, I would
need this information in order to create the ID appriately. I am not
sure what other possibilities I have in order to create a meaningful
trade ID. Any suggestions are welcome.

Best,
Andreas 


0
Jeff
12/14/2009 4:13:14 PM
Reply:

Similar Artilces:

Calculating Taxes and Making calculations
Hello, Kindly plz tell me how do i go about making some small calculations based on my existing data such as how to compute taxes and do other calculations based on some quantitative data. where exactly do i make modifications on my application??? Kindly help me out. Thanks , swati you can add code in javascript behind dropdowns or piclist fields. One example might be a dropdown which has shipping options ie ups, fedex etc. When you choose one it takes the weight of your package (whcih you enter) then calculates a shipping cost. search the archives of this group at groups.google.com and ...

Pivot Tables. A goob book required
I need a power users book on Excel 2000 or later Pivot Tables. Any Suggestions Please? WardB I don't know of any books dedicated to PivotTables, but there are some links to information here: http://www.geocities.com/jonpeltier/Excel/Pivots/pivotlinks.htm WardBell wrote: > I need a power users book on Excel 2000 or later Pivot > Tables. Any Suggestions Please? > > WardB -- Debra Dalgleish Excel FAQ, Tips & Book List http://www.contextures.com/tiptech.html ...

Procedure to calculate distance using latitude/longitude
Does anyone know of a vba procedure for access that will calculate straightline distance using latitude and logitude for 2 points? AJ wrote: > Does anyone know of a vba procedure for access that will calculate > straightline distance using latitude and logitude for 2 points? See: http://groups.google.com/group/microsoft.public.access/msg/6b934b0e580b974b James A. Fortune MPAPoster@FortuneJames.com ...

IIF statement pulling from wrong field
I have a query have has the 5 variations of the following IIF statement: Bag Total: IIf(" " & [Unit of Measure] & " " Like "* BAG *",[Qty],Null) this statement says to add up if the unit of measure if it is a bag. I am attempting to add another IIF statement that says =Sum(IIf([product type] Like "*printed*", [pounds], 0)) - I am trying to add up if the product type has the word printed in it total it at each customer and at the end of the report. When I use this IIF statement on my report, it is totalling the amount from the printed IIf(...

How to calculate age of a person?
Hi, I'm struggling to figure this one out. I have a date column and I'd like to be able to calculate the age without doing it in my head. I've tried to do this but am struggling. Any help will greatly appreciated. Thanks Suzanne Visit www.cpearson.com and search for DATEDIFF best wishes -- Bernard V Liengme Microsoft Excel MVP www.stfx.ca/people/bliengme remove caps from email "Grd" <Grd@discussions.microsoft.com> wrote in message news:6BFFD11C-AECB-4837-93B6-D84B6170B975@microsoft.com... > Hi, > > I'm struggling to figure this one out. I have...

Form Fields
I have created a form for use by others. I used the Text form fields format when creating the form, my problem is the main text in the form does not stay locked in place. When we try to type to fill in the form fields it moves the main body text. I have tried using the Document Protection tab and telling it to allow formatting only in the form fields but that still does not prevent the other text from moving. I did this in word 2007. Any idea on what to do to lock the main body in to allow filling in just the Form fields. Hi Michael, The simplest way to gain control over the ...

EXCEL 2007 Formula to calculate INTEREST only on a 3 month bridge
I am trying to calculate monthly INTEREST ONLY payment on a short term bridge/swing loan. Assuming an interest rate of 2.75%, paid monthly, Also assuming it will be required for a 3-6 month period, amount approx $500,000. Just switched to Excel 2007 but don't seem to be able to calculate using the formula builder. Not sure if it is compounded daily or monthly. You might want to check out the IPMT function. From the XL help file: IPMT(rate,per,nper,pv,fv,type) Rate is the interest rate per period. Per is the period for which you want to find the interest and must...

Due Date Calculated
I need assistance on an expression that allows for the due date of recurring training to be one year from date completed. Details are as follows: I have a form named [frmTRNComplete] based on table named [tblTRNComplete] Form controls are: TRNID (combo box), DateComp (Text Box) , DateNext (text box), Reccuring (check box) I would like the DateNext to be 1 year from DateComp if Reccuring is true and Date next to be blank if Reccuring is false. -- Aloha, Ron A. Ron I'll assume that you want to use the form to calculate the DateNext, and that you are not trying to s...

how to calculate outliers
Google is your friend: http://www.google.com/search?q=calculate+outliers - Jon ------- Jon Peltier, Microsoft Excel MVP Tutorials and Custom Solutions Peltier Technical Services, Inc. - http://PeltierTech.com _______ "ismhs" <ismhs@discussions.microsoft.com> wrote in message news:035124A0-06FA-4153-932E-6C4E0614F38C@microsoft.com... > ...

Calculated field options???
Here's my Data: Country Status --------- ---------- Canada Green Canada Blue Canada Green Canada Green Canada Blue In my pivot table, 'Country' is an item, and 'Status' is my only data field. What I really need to show in my data area is two column of data, one for 'Green' and one for 'Blue'. I tried creating two 'Calculated' fields with the following formulas, but they don't seem to be working: 'CalculatedField1' = IF((STATUS="Green"),1,0) 'CalculatedF...

Time Sheet Function to Calculate
I am having some trouble trying to establish a formula that will give me the number of hours worked during the day given the start time say 8.30am with an end time of 5.30pm and say 30 minutes for lunch. For this scenario, total working hours would be eight and a half hours but I need Excel to display this result as 8.30 hours (0.30 being the minutes in the half hour) and not 8.50. Can someone suggest what to do? Typically the layout would be Column A - Start Time say 8.30am Column B - Time in minutes spent at lunch say 30 minutes Column C - End Time say 5.30pm. Column D - the calculati...

Making one field bold in a concatanated string
This issue is in MS Access 2003 I have a string with the last name and first name fields concatanated. I would like to bold the last name field only. Is there anyway to do this? The standard text box in Access 2003 and earlier cannot do that. Stephen Lebans has a solution here: http://www.lebans.com/mixbold-plain.htm -- Allen Browne - Microsoft MVP. Perth, Western Australia Tips for Access users - http://allenbrowne.com/tips.html Reply to group, rather than allenbrowne at mvps dot org. "abnewallo" <abnewallo@discussions.microsoft.com> wrote in message news:519C584...

Dynamics 4.0 slow to retrieve data when custom fields / lookups us
We've have this issue whereby if a custom field, say on the contact, is indexed, when you use advanced find, it seems to use the index. The response is acceptable. It appears however it you use the standard search bar and try the lookup, it appears that table scans are happening. Can anyone advise if we're reading the situation correctly and whether there is a way to speed up to normal search. Thanks -- C ...

Getting primary/foreign keys and referenced tables and columns
OK, I've been wrestling with this for a while; time to ask for help. I need a query (SQL 2005/2008) that, given a table name, will return the column information for that table as shown in SSMS (schema name, table name, column name, if it's a primary or foreign key; AND, additionally, if it is a foreign key - the referenced table and column that contains the primary key). I have been able to put together a query to get primary keys and one to get the foreign keys, but unable to pull it all together with the inclusion of the reference information for foreign keys! Any h...

tenure calculations
how can I format several dates such as 04/19/2003, 04/01/2004, etc. int a yearly average for the employee tenure -- Message posted from http://www.ExcelForum.com right now say I have my yearly figures in i1-i9. The formula I though would work is =today()-average(i1:i9), but how would i format this to give me yearly read out -- Message posted from http://www.ExcelForum.com Hi djackson! One way is to use YEARFRAC with a third argument of 1 to get your tenures in years and fractions of a year and then average the result. However YEARFRAC does produce some annoying but small errors. Y...

Formula to calculate time
I was wondering if anybody knows of a formula to allow you to do calculations based on time. In other words, say I want to put a list of songs on a CD and their durations. Then, I want to add up the durations to get the full time of the CD, or my specific play list. So for example, using the information below: Ghostbusters - Ray Parker Jr. --- 5:23 (Just a guess) Phantom of the Opera Overture --- 3:55 (Another guess) Instead of 8:78, I'd want to see 9:18 Can this be done? Any help would be greatly appreciated. Thank you! -- Have a nice day! ~Paul Express Scripts, Charting the futu...

Insert calculated median field in pivottable
Anyone know how to get a median calculation in a pivot table? I've tried inserting a calculated field but it always sums the calculated field. Thanks, Joel Not supported in a pivot -- Regards, Peo Sjoblom (No private emails please) "Joel Schaefer" <joel@disintegrators.com> wrote in message news:ev4P0Nk6FHA.2616@TK2MSFTNGP15.phx.gbl... > Anyone know how to get a median calculation in a pivot table? I've tried > inserting a calculated field but it always sums the calculated field. > > Thanks, > > Joel > ...

Is it possible to have different send/receive patterns at different times?
Basically, here's what I want to happen. >From 8-5 or so, Outlook downloads my e-mail automatically with Send/Receive. At 5 or 5:30, when I leave the office, Outlook stops, and I can check my e-mail through our web interface. The simple approach is to just close Outlook, but I tend to forget to do that. So is there a way to set it, either with or without an add-in? Justin <jmeyer@incrementaladvantage.com> wrote: > Basically, here's what I want to happen. >> From 8-5 or so, Outlook downloads my e-mail automatically with > Send/Receive. At 5 or 5:30, when I le...

Copying Addresses from the To field
I thouight I had posted this but if so it's somewhere obscure so I'm trying again! I have a large number of addresses I need tyo get into a manageable format i.e. useable email addresses, a latge proportion are formatted like this: 'familiarname!<someones@somewhere>. If I copy no matter what I do it will only paste the familiar name, the address is lost. I have tried every combination I cam think of. I have about 800 addresses and it would be aweful if I have to manually edit them. Any ideas? thanks If they in the To... field, right click each individually and select Add...

Validation
Anyone know if there is a way to do this? I would like to change the width of the box (and perhaps the color, border, etc.) Thanks! Esme -- EsmereldaPea ------------------------------------------------------------------------ EsmereldaPea's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=14699 View this thread: http://www.excelforum.com/showthread.php?threadid=263216 Hi not possible -- Regards Frank Kabel Frankfurt, Germany "EsmereldaPea" <EsmereldaPea.1d3g40@excelforum-nospam.com> schrieb im Newsbeitrag news:EsmereldaPea.1d3g40@excelforum-...

Javascript help, calculation whoes when calculating from a calculation....
I am having a strange issue with Javascript and I cannot see what the issue us? Essentially I need to be able to calculate two values, one is addition and the second is multiplication. I am getting some strange numbers. My code is at the bottom under the ------, here are the details. crmForm.all.estimatedvalue.DataValue = 10 crmForm.all.new_cfp_estrev_nextyr.DataValue = 10 crmForm.all.new_cfp_estrev_yrtwoplus.DataValue = 10 This should make totalestrev = 30, Then its getting weird, I am taking the following formula (10/100)*30 = 270? Here 10 is the value selected from the drop down value, I ...

calculator errors
when i enter an equation into a cell such as: =product(a1,b1) into cell c1. If a1 is 1000 and b1 is .10 than c1 should equal 100, but it equals 102.04. My calculator is off somehow when i try to multiply. Please help me. Thank You, Kat I'd take a look at the values in A1 and B1. Are they really 1000 and .10 or are they 1000.49999 or .10444 (for example) "Kat and the Calculator" <KatandtheCalculator@discussions.microsoft.com> wrote in message news:591A3F6E-7C20-4C88-B1E2-6B76CFF502BA@microsoft.com... > when i enter an equation into a cell such as: =product(a...

Printing 2 documents at the same time from different trays
When sending letters to clients, I would like to be able to print a copy on headed and also a copy on plain paper for the file. Is there anyway I can create a setting for this? It would be fairly straightforward using a macro to select the trays and print the document, change trays and print it again. You will find code at http://www.gmayor.com/fax_from_word.htm that you can modify to achieve this. If you need any further help let us know. -- <>>< ><<> ><<> <>>< ><<> <>>< <>><<> Graham M...

Calculating Employee hours for the current week
Hello, I am new to excel and have been assigned the task of creating a file that breaks down the amount of time each of our employees spends on different projects. Most importantly I want to create a rollup sheet that shows the total number of hours all the employees have spent on the different projects (there are 6) for the current week. Is there any way for excel to figure out the current week then add together the hours all the employees worked on these 6 projects? Thanks in advance. Hi, Take a look at the templates available from Microsoft at http://office.microsoft.com/en-us/template...

What does this calculation do?!
I am working with a colleague to create a spreadsheet to rank supervisor performance through several aspects of the average performance of their employees. We have been given a similar spreadsheet as an example of what is needed. I am looking at it, and initially cannot understand what in the world some of the calcuations are meant to do. Here is one that is meant to calculate the "ranking score." It is a percentage determined by a target percentage and the person's actual performance percentage: =IF(IF(C3>0,(C3/B3),200)>200,200,IF(C3>0,(C3/B3),200)) As far as I ...