Solved

Total

Posted on 2006-11-09
7
275 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
Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

 

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

Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When you are entering numbers in a speadsheet, and don't remember what 6×7 is, you just type “=6*7" instead. It works in every cell! This is not so in Access. To enter the elusive 42 in a text box, you have to find a calculator, and then copy the re…
In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

809 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