Solved

Total

Posted on 2006-11-09
7
253 Views
Last Modified: 2012-06-22
Hi,

I have two tables name tblAMKCC71 and tblAMKCGP:  

In tblAMKCC71 fields are: overnight, dayshift, eveningshift
In tblAMKCGP fields are: overnigh, dayshift, eveningshift

There is a third table  name tblrptPharmacy
In tblrptPharmacy field is: generatedOrders

I want to total tblAMKCC71 and tblAMKCGP fields together and put in tblrptPharmacy field name generatedOrders.

How do i go about doing this.

I know to create a query but i know how to sum single field but not the multiple fields of different table.

I am very beginner programmer in access.  Help greatly appreciated.
0
Comment
Question by:sikan71
  • 4
  • 3
7 Comments
 
LVL 44

Expert Comment

by:GRayL
ID: 17908431
How does the Pharmacy table relate to the two AMK tables?  What field is common among the  three?
0
 

Author Comment

by:sikan71
ID: 17909117
There is no relationship:  i am trying to put all the totals in table tblrptPharmacy.  So that i can create a report on monthly basis.  I have 10 tables for each building at my work,  the data get entered on daily basis.  But i have created query which pulls the data of previous month and does the sum for each field of each table. for example, Now say i have the sum of each field in the tblAMKC71 and also tblAMKCGP.  I want to add together certain fields of tblAMKCC71 and tblAMKCGP and put it in different table tblrptPharmacy and call the field name generatedOrders. Hope this is clear.
0
 
LVL 44

Expert Comment

by:GRayL
ID: 17909290
Well, here's literally what you asked for:

INSERT INTO tblrptPharmacy (GeneratedOrders) Select Sum(overnight+dayshift+eveningshift) from tblAMKCC71;
INSERT INTO tblrptPharmacy (GeneratedOrders) Select Sum(overnight+dayshift+eveningshift) from tblAMKGCP;

0
Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

 

Author Comment

by:sikan71
ID: 17909405
Instead of running a query with insert can i directly use this values in the report.
My problem is since my database has 10 tables(each for different building).  My report needs to use all 10 tables to get the values i need from each field.  As far as i know you can use only single recordsource.  How can i achieve this.  As i mentioned previously very new to access

My report setup:

Building:                ARDC     AMKC        GMDC   ............                                   Total


Type of Orders
# Of Formulary
# Of Nonformulary
Total Orders


# Of Orders
Keep
Detox
Total Orders


So i have it set up like this.

Say for building AMKC:  I need to put the totaled value i mentioned above in the # Of Formulary.  Is it possible to sum here instead of writing separate query.


0
 
LVL 44

Accepted Solution

by:
GRayL earned 125 total points
ID: 17909761
You can use a domain aggregrate function as the control source for a textbox tbxAMKCC71:

=DSum("overnight+dayshift+eveningshift","tblAMKCC71")

then for tbxAMKGCP

=DSum("overnight+dayshift+eveningshift","tblAMKGCP")

and so on.  Does this help?

0
 

Author Comment

by:sikan71
ID: 17909943
Is it possible to combine both tables field values into one since I want AMKCC71 and AMKCGP into the tbxAMKC  There is no tbxAMKCC71 and tbxAMKCGP.  
0
 
LVL 44

Expert Comment

by:GRayL
ID: 17939545
tbxAMKC control source.

=DSum("overnight+dayshift+eveningshift","tblAMKCC71") + DSum("overnight+dayshift+eveningshift","tblAMKGCP")

Thanks, glad I could help.
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Today's users almost expect this to happen in all search boxes. After all, if their favourite search engine juggles with tens of thousand keywords while they type, and suggests matching phrases on the fly, why shouldn't they expect the same from you…
In the article entitled Working with Objects – Part 1 (http://www.experts-exchange.com/Microsoft/Development/MS_Access/A_4942-Working-with-Objects-Part-1.html), you learned the basics of working with objects, properties, methods, and events. In Work…
Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now