Summing Conditional Multiple Fields

Mar 1, 2007

Hi all, sorry to bother you all, especially if this has already been answered, but I can't seem to find the solution to it. Assuming that what I've been doing has been correct that is.

I have three (3) tables with the following fields (where PK is primary key);
[tbl Ingred]: IngredID (PK), ProdID_fk, CompCode, IngredName, Weight, Symbol, RP01, RP02, RP03, RP04, RP05, RP06, RP07, RP08, RP09, RP10
[tbl Prod]: ProdID (PK), ProdName, FP, BP, SBU, ProdNotes
[tbl RPCalc]: RPs, RPs_long (PK), Sym, Limit, Sym_1, RP_1, Comp_1, Add, RP_01, RPNotes

[tbl Prod] has a one-to-many relationship with [tbl Ingred]; that is, for one ProdID, there can be many IngredIDs. The tables are designed so that the final user-displayed form is 'user-friendly'.

I've made a qry called [qry Qcalc] used to calculate the the Quotation (Q) of each of the 10 RPs (RP01 - RP10). Which simply for the first one is; QRP01: [Weight]/[tbl RPCalc_1].Limit, where the [tbl Ingred].[RP01] is linked to a corresponding [tbl RPCalc], by the [RPs] field. As for one [RPs] there may be multiple [RPs_long]. The way it is set up is so that the [RPs] and [RPs_long] are mapped correctly, to be used for calculations.

However, I am now stuck with a problem. I need to sum up these QRP values ([QRP01] - [QRP10]), based on (at least?) two conditions. The user can enter in their RPs; e.g. R10, R20, R21 in any of the [RP01] to [RP10]'s, and in any order.

What I need is to be able to obtain a sum of the Q values for each [RPs_long] (e.g. R10, R20, R21), rather than being the sum of the fields [RP01] to [RP10]. Also, each [RPs_long] may or may not be able to be summed up, depending on another field [Add] which has a "Yes" or "No". "Yes" is for it being able to be summed up, and "No" for it not being additive.

So the end result would be; for each [ProdID], there will be multiple [IngredID] where each will have up to ten (10) "RPs" (that being the [RP01] to [RP10] fields). These inputted "RPs" are then related to [tbl RPCalc] to be able to obtain the Q-values. If the Q-Value is not greater or equal to 1 (>= 1), then the sum of the Q-values for each [RPs_long], provided that the [Add] field is "Yes", will then be able to determine what are the final output RPs to be used, i.e. for the sum of the Q-values are greater or equal to 1 (>= 1), that [RPs_long] will be used.

I've been stuck on this for quite some time, and I know that if I change the whole table structure (like having a field for each RPs in the [tbl Ingred]), I might be able to make it much easier for myself. However, by doing so, it will not be able to offer as much flexibility in the calculations, and also, may not make it as 'user-friendly'. Another thought was maybe to create another table with just the [CompCodeID] (based on [tbl Ingred].[CompCode]), [Weight], [RP], but I'm not too sure how this will work either, but I might give it a shot if this current method doesn't work.

I hope that this made sense, as it is all quite complex (and confusing) to me. Any help on this matter will be much appreciated. Thanks in advance.

View Replies


ADVERTISEMENT

Summing Multiple Fields From One Table In A Form

Apr 1, 2014

[AR&R Hours]+[PTO # of Hours]+[Meeting/Calls # of Hours]+[System Issues # of Hours]+[BAU Training # of Hours]+[Exception Processing Hours]+[AIG Related Activities]+[Admin Work Hours]+[Migration Hours]+[Project Hours]

Need the fastest and easiest way to auto calculate the above in a field on a form. i can get it to calculate in a query but need it to do in the form as well.

View 14 Replies View Related

Modules & VBA :: Summing Multiple Queries And Summing Time

Oct 4, 2013

I have a sales form. The sales form has many Call, Meetings and Emails linked to each sales record. I want to total all the number of calls, meeting and email records related to the sales record to give a total- Touches.I've created 3 queries;

1 - Counts Calls
2 - Counts Emails
3 - Counts Meetings

These all work fine however when I combine them to attempt to count the results it doesn't produce the correct results.I have a second query as well (no pun intended).

I am trying to sum together a column that has values in Time. The results displays as a decimal. How can I have the result display as a Time i.e. 1:20 (1 hour 20 minutes).

View 1 Replies View Related

Reports :: Conditional Formatting On Multiple Fields Based On Two Criteria

Sep 24, 2014

I have a report which I would like to apply conditional formatting on multiple fields. I would like the conditional formatting to be based on two types of criteria

First criteria would be contracts that start with the year 2014. I used the following expression which worked - InStr(1,[ContractNr],"2014" AND [DirectorInCharge]= "Joseph Steinbok" or "Adam Godson")

To this expression I would also like to highlight fields which contracts start with 2014 AND have a particular Director assigned to it. For this I used the following expression - And [DirectorInCharge]="Name"

On their own, both expressions are working but I want to combine them. How do I do this? I've tried the following - InStr(1,[ContractNr],"2014" AND [DirectorInCharge]= "Name") but then nothing is highlighted. I also tried InStr(1,[ContractNr],"2014") AND [DirectorInCharge]= "Name" - in this instance EVERY record was highlighted.

View 4 Replies View Related

Summing Many Yes/no Fields

Jan 9, 2008

Hello, I am a newbie access user, so this might be a stupid question, but here it is:

I have a lot of yes/no fields labeled "10/1", "10/3", "10/5", ... (dates)
They are to record attendance on particular days.
I want to make a query that gives me the sum of a student's attendance and I have no idea to go about that. Any help is much appreciated.

Thanks!!

View 1 Replies View Related

Summing Fields In A Record

Aug 23, 2005

Hi,

Not sure if this is possible (sounds simple hopefully) but I was wondering if there was a way to sum certain fields in a record on a continuous form.

E.g. Field1 and Field2 in record 1.

Is it something simple like summing columns, i.e. Sum(Field1)?

Any help would be much appreciated.

View 1 Replies View Related

Summing Up 3 Fields In A Record

Nov 12, 2007

Hi,
I am trying to figure out the best way to design a table. The table is going to contain data concerning checks that have been given to a church. Each check could be broken down into 3 different categories; Tithes, Offering, Other. In other words one check for $100 dollars might be Tithes $40.00, Offering $30.00, Other $30.00. I need to be able to enter these three amounts into the record and then have them totaled in another field.

Is it best to do this all in one record or should I have two tables? If I have two tables how do I get one form to enter the break down into one table and the total in another table. Fyi, if I do this in one record I don't want them to have to enter in the total. I want the total that is entered to be calculated by the three previous fields.

Thanks for any help you can be on this.

View 14 Replies View Related

Summing Other Fields Per Record

Jun 28, 2006

Is there a way to use a query to sum totals of several fields per record? In the db I have designed, I have 5 seperate fields for estimates from different departments. There is also a field for Total estimates. What I would like to do is have the Total Estimates field autocalculate the total sum of the other 5 estimate fields. Is this possible to do through a query? If so how? If not - is it possible at all?

Thanks!

View 1 Replies View Related

Summing Two Fields In A Query

Jul 17, 2007

I have 2 fields, Accounts, Accounts CMO. I need those two fields to show in the same table in a new field called Total Accounts. I am summing them, but getting irregular results, some are right, and some are 4 times more than they should be? How would you go about doing this, maybe I am missing something.

View 1 Replies View Related

Hi! I Need Help With Summing Fields And Expressions

Dec 18, 2006

Hi! I'm trying to create a query using option groups, i have two options the first one is STOCK and the other is PD.
If i select stock the the query i want to create to introduce it on a form is:
I have 5 fields
-denominación
-reserva
-almacen
-cantidad
-stmax
If i select stock
then the query is
If (reserva +almacen)<cantidad then on a sub form have to appear the table with all the rows where (reserva +almacen)<cantidad.
but if i select PD only have to select on stmax the rows where value=PD
PLEASE i need help with this....

View 1 Replies View Related

Summing Fields In A Form

May 1, 2007

I have run into this problem with several databases I have created. I have my tables all set to store my information. I create the form to enter the information. I try to create the field to calculate a total and every time I enter the amount in the form, I get '?name' or '#name'.

With this particular database, I am looking to track expenses. Expense categories on the left, dates across the top, amounts in the middle, totals across the bottom for dates and down the right for categories.

If there was a way to attach a document, I would send the expense report. If you want to look at it, let me know and I will send it. It's a small xls file.

Thanks.

DT

View 2 Replies View Related

Summing Multiple Columns In The Same Query...

Oct 27, 2005

Hello! I'm new here, and I'm back into Access after a few years of not using it.

What I'm trying to do seems simple, but I can't seem to get the sytax down.

I have 6 columns that have dollar figures in them. I want to get the totals for all 6 columns to show in one field. I'm using the sum([field]) to total the individual columns, but I can't seem to get all of them together in one sum. Is this possible?

Thanks!! :D

View 8 Replies View Related

Summing Different Multiple Amounts With Grouping

Jul 13, 2006

hey all, thanks to anyone that can help

i have 5 fields facid custid empid amount invdate.

i need to be able to get totals on the amount based on fac, cust & emp based on a date range given by user, but here's the kicker.. i need to get the current month totals, month totals - 1year (so same month but for last year)
the date range totals, last yeardate range
current ytd, last ytd

i did it using code, but the performance isn't that great. there are 2800 customers it has to cycle through and figured one of the resident experts can help with a query.
i've used dsum() but not quite getting the results i should.
i think one of the problems is the user has the option of filtering the data based on the 3 fields.

anyways if you can help i'd greatly appreciate it..

View 2 Replies View Related

Summing In Query By Multiple Characteristics

May 12, 2005

I'm trying to sum revenue by unit by program by segment but it's seem to be summing it by all units or all programs. my joins
are the first option egaual to both tables. it's a select query and only has two tables. the unit, program, segment are all 'group by' and the revenue is 'sum'. could my joins be wrong or is there another reason i'm not getting the sum by unit by program by segment?

View 2 Replies View Related

Summing Fields, Ignoring Certain Values

Jan 29, 2008

I have a number of fields that hold values (scores - either 0,1 or 2) that need to be summed but in some cases the value is 99 (which is recognised by our stats program as a N/A type of anwer- This occurs when a question is optional and the user hasnt answered it. I did not want to value to be null (since its not like the user didnt answer it because they missed out on it by accident but rather they could not) and it couldnt be 0 either since 0 actually means something different in the context of the questionnaire.Lets say I have Q1 which has a value of 0, Q2 has a value of 1, Q3 has a value of 99 and Q4 has a value of 2I want to get the total of Q1+Q2+Q3+Q4 for a particular entry but if the value of any or all of the questions are 99 I want access to ignore it and just sum the rest of the values i.e. the sum should read 0+1+2+(99)=3 not 102I want to be able to include this sum function in the expression builder if possible since I am using it for a report. Can someone please help?

View 3 Replies View Related

Problem With Summing Fields In Subforms

Nov 17, 2006

Would like to create a sum of a field in a sub form. I am using =sum([name of field]) in the footer of the sub form but it only gives me the answer of the first entry in the form. I also created an unbound box in the detail portion =[table1 subform].[form]![name of field]. What am I doing wrong?

View 1 Replies View Related

Summing Specific Fields On A Report

Feb 14, 2014

In the footer of my report I have a field that sums the Transaction Amounts - =Sum([Transaction Amount])

I would also like to break the totals down further by Transaction Type Codes.

Something like =Sum([Transaction Amount]) where Transaction Type Code = AL-Exp-Paid

View 4 Replies View Related

Queries :: Summing Columns Into Multiple Rows?

May 13, 2013

I have a linked table. The table looks like:

Course 1 Name | Course 1 Grade | Course 2 Name | Course 2 Grade |
Student 1
Student 2
Student 3

I need to write a query that will consolidate all the courses (15 total) into multiple rows like this:

Course name | Course Grade
Student 1
Student 1
Student 2
Student 2

What is the best way to do this?

View 8 Replies View Related

Queries :: Expression Summing From Fields With Dates

Aug 3, 2015

I am involved in centrally managing a project , a part of which involves employees of certain companies being given a weekly subsidy for study on academic courses. I have successfully set up a table for all the learners and a related table for companies.

Each learner will receive a fixed weekly rate subsidy in the first year, and a lower fixed weekly rate subsidy in the second year. Somebody (not me) will need to check their paychecks to ensure that employees have been paid and all is above board. The learners/employees can start on the programme at any time. I need a way to track this (total claimed amounts, where they're up to etc).

My theoretical solution, is to have a field for each week a learner is on the programme (52 first year, 52 second), and instead of entering a currency amount in the field, the check-person can enter the date they saw the evidence and are happy with it. I thought then if I create a query that searches any dates that fall within the current claim period (eg >01/01/2015, <=Date()), and multiplies field count that fall within those parameters by first/second year subsidy rate if they're in that table. I think my logic is sound, I am just not sure how to write the query/expression, or if it's possible, or if there is a much simpler way to do it.

View 4 Replies View Related

Queries :: Summing Days Late Through Multiple Columns

Aug 29, 2014

I have 4 revised ship date columns, an est ship date, and an actual ship date. I have a column summing days late for est ship date and one summing revised days late. The expression I am having problems with is to calculate the total days late for the revised. I want it to check the 4th revised and if it has a date calculate from that date. If not I want it to go to the 3rd and calculate from that, and so on. I have pasted the code I was trying to use. It just goes all the way to the bottom of the code and calulates from the 1st revised ship date. I have also attached a jpg of the layout of the columns. I also want to do this in the query using expression builder.

Days Late Revised: IIf( [4th Revised Ship Date] <>null,(DateDiff("d", [4th Revised Ship Date] ,
[Actual Ship Date] )-DateDiff("ww", [4th Revised Ship Date] ,
[Actual Ship Date] ,1)-DateDiff("ww", [4th Revised Ship Date] ,
[Actual Ship Date] ,7)),IIf( [3rd Revised Ship Date]<>null ,(DateDiff("d", [3rd Revised Ship Date] ,

[Code] ......

View 1 Replies View Related

Queries :: Summing Quantities Of Same Product In Multiple Locations?

Sep 30, 2014

I have a transactions table which records a qty number (- or +) and references particular location details (location, room, rack, shelf etc). My question is how do I sum the qty for the same product at different locations. So my user sees that product A has a qty of X in location C and qty Y in location D. I can sum the transactions table qty which does give me a sum based on a single location but each location has multiple racks, shelves etc. I need to know the sum of transactions for the same product for exactly the same location, room rack etc

View 3 Replies View Related

Conditional Text Box For Two Fields

Aug 12, 2011

I have text boxes that combine two fields into one, for example the control source is =IIf(IsNull([BuckC])=True And IsNull([BoostC])=True,"",[BuckC] & " , " & [BoostC]) . For simple its just =[Buckc] + ": "+[BoostC]. I am trying to set a condition that if one of them exceeds a certain number the background color will change to yellow. I know how to do this if its only for one field but I am wondering if it is possible to do it with multiple fields?

View 9 Replies View Related

Conditional Format Based On 2 Fields

Jan 24, 2008

Hello All,

I have searched the forum but I don't quite get what I am looking for.
I have a subform that has these 2 fields:
- Status
- LastFollowup

What I want is if the Status shows "Pending" and the date entered on the LastFollowup is more than 7 days. Then it should turn Yellow.

I tried this code in the expression box but it doesn't seem to work

[Status]="Pending" and [LastFollowup]>7


Could anyone please assist? I know this is simple but it's not working for me.

Thank you

View 6 Replies View Related

Forms :: Conditional Mandatory Fields

Mar 20, 2013

Basically I have a form which records primary and secondary reasons for people writing off money, and in the secondary reasons I have an option for 'other', in case any of the other options aren't applicable. There is also a comments section on the form which is optional.

My issue is, I want the comments section to become mandatory if the 'other' option has been selected. I don't want it mandatory all the time, and I don't want it disabled if 'other' isn't selected, but I need to force people to write at least something in there if they have selected other.

I tried variations on code I found from other places but was unable to get this to function, and I am not sure if this can be done with validation or something like that.

View 14 Replies View Related

Reports :: Conditional Formatting On Row Of Fields

Apr 29, 2014

I have a field on a report that I was able to make bold using conditional formatting. I want to make the other fields in the row bold as well if the value of the 1st field equals a set value.

EX: Contractor Bid Amount Sq Footage =[bid amount]/[sq footage] =[bid amount]/[estimate]

I put conditional formatting on the Contractor field

EX: Field Value Is equal to "Estimations"

I was Bid Amount, Sq Footage, =[bid amount]/[sq footage] and =[bid amount]/[estimate] fields to also be bold if the Contractor field is equal to Estimations.

View 11 Replies View Related

Conditional Query For Selecting Different Fields For Each Record

Oct 17, 2007

I have an interesting report query I am working on. Is it possible to have a query that shows different fields for individual records depending on the content of the record? Let me see if I can explain. Let's say that I have a Status field that can be "Complete", "Active", or "Planned". And lets say also in that table I have Field1, Field2, and Field3. For each record, I don't want to include all three fields (Field1, Field2, Field3), but only one of these fields depending on what is in the Status field.

So, it would be something like:

Select Status, (if Status = "Complete", select Field1), (if Status = "Planned", select Field2), (if Status = "Active", select field3) FROM table;

So, the query would result in 2 fields for each record: the status field, and one of the three other fields depending on what is in the status field for that record.

Thank you kindly for your help.

View 2 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved