473,945 Members | 4,114 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Unable to calculate multiple fields from multiple tables. Help!

Hi all,

I have an Access 2003 database that has been a work in progress for a
while, it's basically a
system inventory and issue tracking system. Recently I have added a
seperate area for keeping

track of total disk space allocation and usage. For the most part I
have the data keyed in but

am pulling my hair out trying to get some calculations.

The main table is very simple, it consists of these fields:

MD - Meta device
MDSize - the size of the meta device

There are only two MDs so far, D60 and D61. Volumes are built on top
of these devices and are

also numbered, i.e. 70, 71, 72, etc. The volumes themselves are in
another table with these

fields:

MD - Meta device upon which this volume is built (this links to MD in
the first table)
Size - size of this volume

So I have MD D60 which houses 70, 71, 71, etc and MD D61 which houses
80, 81, 82, etc.

What I am trying to do is create a form that will keep a running total
of how much is in use and

how much is available. The easy part is the total, that is defined
within "MDSize" of the first

table, that is a static number that will not change. I have done
simple calulations before

within forms using expressions, but this one is throwing me for a
loop. Mainly because I have

to seperate the two MDs, and further break them down by the volumes
built on those MDs.

This is what I envision:

MD D60: Total = 125 Total available = ?
MD D61: Total = 125 Total available = ?

The total available has to be the sum of Size in the second table, but
not the total for ALL mds,

it has to be broken out by each md, i.e.

D60: Total used = 90
D61: Total used = 50

It's easy enough to do a sum on a field, but for the life of me I
cannot get the syntax right to

sum a field based on a given criteria, in this case twice: once for
D60 and once for D61

Then to make things more complicated, once I have obtained this sum, I
need to subtract it from

the MDSize in the first table, again having two seperate calculations.

If this makes any sense to anyone that can offer assistnace, please
let me know! I realize it may

be hard to understand based on my rambling but I will try to answer
any specific questions.

Thanks in advance!

May 17 '07 #1
3 2579
Ok, looking back at this post it looks like a complicated mess! I
managed to get some more work done and I am close but not quite
there. This expression:

=IIf([MD]="D60",Sum([Size]))

*Almost* gives what I need: it searches the [MD] field for the value
"D60" and returns the sum.

Now I just need it to return only the sum of the field [MD] that
contains D60, as it is now it returns ALL of the values...

How can I isolate it so I see the sum of [Size] only where [MD]
equals D60?
May 17 '07 #2

"EyeHaveNoN ame" <Ey***********@ gmail.comwrote in message
news:11******** **************@ h2g2000hsg.goog legroups.com...
Ok, looking back at this post it looks like a complicated mess! I
managed to get some more work done and I am close but not quite
there. This expression:

=IIf([MD]="D60",Sum([Size]))

*Almost* gives what I need: it searches the [MD] field for the value
"D60" and returns the sum.

Now I just need it to return only the sum of the field [MD] that
contains D60, as it is now it returns ALL of the values...

How can I isolate it so I see the sum of [Size] only where [MD]
equals D60?

=Sum(IIf([MD]="D60",[Size],0)

May 18 '07 #3
On May 18, 9:06 am, "paii, Ron" <p...@packairin c.comwrote:
How can I isolate it so I see the sum of [Size] only where [MD]
equals D60?

=Sum(IIf([MD]="D60",[Size],0)

Thank you! That is perfect.

May 18 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
13613
by: sg_s123 | last post by:
============================================================================ 02-Feb-04 03-Feb-04 Staff Staff 0800hr- 1300hr- 1700hr- 1900hr- 0800hr- 1300hr- 1700hr- 1900hr- Number Name 1200hr 1700hr 1900hr 2200hr 1200hr 1700hr 1900hr 2200hr ============================================================================ 4654 Saniff A A A C A A A C 4437 Joey B C B C B C B C 4479 Elmer C C B C C C B C
7
2194
by: Michael Deathya | last post by:
Hi, I am pulling over 400 different metrics from an Excel spreadsheet into Access (97). Conceptually, each row represents a single set of these 400 metrics. However, because of the 255 column limit in Access I am faced with a dilemma: Do I create two tables (1 with 255 columns, the other with 145) and a lookup table that stores which metric is found in which table? Obviously this method would require VBA logic to coordinate any time I
11
4555
by: dskillingstad | last post by:
I've been struggling with this problem for some time and have tried multiple solutions with no luck. Let me start with, I'm a novice at Access and I'm not looking for someones help to design my database,just help in getting me pointed in the right direction. I have a database with 8 tables, which from what I have read, cannot be linked on a single form, and be updatable. I have created a query which includes all 8 tables, and then...
5
4195
by: JP SIngh | last post by:
Hi All This is a complicated one, not for the faint hearted :) :) :) Please help if you can how to achieve this search. We have a freetext search entry box to allow users to search the database. I am searching two tables. SELECT TapeRecords.Id, TapeRecords.ItemTitle, TapeRecords.SourceRef,
1
4799
by: NumberCruncher | last post by:
Hi All, I am struggling with setting up my first system of tables, forms,and reports, and could use your help! I am setting up a database to keep track of the production of a produced item. The item is a panel, with a specific texture. There are standard panels that are then produced in a limited number of specific textures. The number of panels/project varies, so I keep track of the actual number of panels per project with the count:...
52
6450
by: MP | last post by:
Hi trying to begin to learn database using vb6, ado/adox, mdb format, sql (not using access...just mdb format via ado) i need to group the values of multiple fields - get their possible variations(combination of fields), - then act on each group in some way ...eg ProcessRs (oRs as RecordSet)... the following query will get me the distinct groups
11
3704
by: shriil | last post by:
Hi I have this database that calculates and stores the incentive amount earned by employees of a particular department. Each record is entered by entering the Date, Shift (morn, eve, or night) and the 'employee name'. There is another table which assigns an ID to the Shifts, i.e. 1,2 and 3 for morn, eve & night shifts respectively. From the mother table, the incentive is calculated datewise for each employee as per his shift duty. In...
1
1197
by: nafise | last post by:
Hi, I have a problem in calculating a field in a table. I have 2 tables with these fields: 1- examcode , p1, p2, P 2- examcode, f1, f2 I want to update the first table to calculate the value of "P" field. It is a bit complex, because I want it to be calculated like : P= (p1 * f1 + p2 * f2) / (f1 + f2) if p1 <> -1 and p2 <> -1 ( if any of these two is -1 it should be omitted from the formula) (p1 , f1 and p2, f2 are the...
3
7210
by: DeanL | last post by:
Hi guys, Does anyone know of a way to create multiple tables using information stored in one table? I have a table with 4 columns (TableName, ColumnName, DataType, DataSize) and wanted to know if there is a way to use the information in this table to create the many tables that are listed in the source table instead of creating each table individually? Many thanks for any help you can offer.
0
10149
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
11548
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
11140
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
11319
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9872
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
7402
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
6093
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
6315
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
3523
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.