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 / Database Design / April 2005

Tip: Looking for answers? Try searching our database.

How do I add two table values and publish to a third table?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Prellyan - 23 Apr 2005 12:00 GMT
I have value to add two values from two tables and publish results to a third
table.

ie:

(v1 in table A) + (v2 in table B) = (v3 in table C)

Is there a quick way to do this.

Thanks
tina - 23 Apr 2005 13:07 GMT
> publish results to a third table.

do you mean *store the calculated value in the third table* ? well, normally
you wouldn't. a standard rule is that you don't store calculated values when
you're already storing the raw numbers; you just recalculate the values
whenever you need to display them (in a query, form, or report).

there are exceptions to every rule, of course, so if you have a valid need
to store a calculated value in a table:  you can easily calculate a total in
a query. add both tables to the query, then create a calculated field with
the A + B expression (leave out the "= C" part). make it an Append query if
you need to add the calculated value to the table as a new record. make it
an Update query if you need to add the value to a field in an existing
record in the table.

hth

> I have value to add two values from two tables and publish results to a third
> table.
[quoted text clipped - 6 lines]
>
> Thanks
Tim Ferguson - 23 Apr 2005 20:15 GMT
> (v1 in table A) + (v2 in table B) = (v3 in table C)
>
> Is there a quick way to do this.

Which v1, v2 and v3 values? There is one of each for every row in the
tables, so if you have 1000 rows in each table there are a billion ways
of answering this! At the moment, all you have described is that you want
to add NumberOfPassengers to PencePerKilogramme and store the answer in
DaysSinceDischarge.

Presumably you do have some way of joining all three tables together:
once you have done that, then the addition is a simple UPDATE query. Post
more information if you need further help.

B Wishes

Tim F
Prellyan - 24 Apr 2005 10:43 GMT
Yes i know about the report extraction from raw data using query - basically
i was trying to ensure that query result data was available "real time" as a
table subform under an input form

ie - main form = user data
     subform inside main form    = additions
     subform2 inside main form  = subtractions
     subform3 inside main form  = SUM(additions + subtractions)

Needed is the ability to add to subform2 and subform3 live with results
published to subform3

Does this make it clearer?

Chris

> I have value to add two values from two tables and publish results to a third
> table.
[quoted text clipped - 6 lines]
>
> Thanks
tina - 24 Apr 2005 11:46 GMT
well, if you're summing a specific field of a specific record from one table
with a specific field of a specific related record in another table, you
still don't need to store that value in a third table. simply link the two
tables in a query, creating a calculated field that adds the two fields.
then bind that query to your third subform.

hth

> Yes i know about the report extraction from raw data using query - basically
> i was trying to ensure that query result data was available "real time" as a
[quoted text clipped - 22 lines]
> >
> > Thanks
Prellyan - 25 Apr 2005 00:59 GMT
Tina,

Yes thanks - silly me - subform query - for some reason i though i could not
do that even though had done it previously - dont know why

Thanks again

Chris

> well, if you're summing a specific field of a specific record from one table
> with a specific field of a specific related record in another table, you
[quoted text clipped - 33 lines]
> > >
> > > Thanks
 
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.