Solved

Total

Posted on 2006-11-09
7
283 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Rounding precision in MS Access 9 55
Flowing down data to other tables 13 32
update query 4 25
Need to prompt to save file from VBA if file exists 6 22
Introduction When developing Access applications, often we need to know whether an object exists.  This article presents a quick and reliable routine to determine if an object exists without that object being opened. If you wanted to inspect/ite…
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.

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