Calculating Column Values

Mar 15, 2006

I have a table with numberous records with Values in a number of fields. In a report I am showing all these records but at the end I want to tally the values.

Whats the best way to do this?

I thought of placing a text box in the form that will run some code to calculated the total....

What kind of code would I use to accomplish this?

Is there an easier way?

View Replies


ADVERTISEMENT

Populating A Column In A Table Based On Values In An Existing Column

Mar 5, 2007

Hi all,

In the organisation that I work for employees get paid every 2 weeks on a Saturday. So for this financial year the pay period end dates have been 08/07/2006, 22/07/2006, 05/08/2006 etc


I have a column in an Access table listing various dates. I want the next column to be
populated with the next pay period end date after that date.

So if DATE is 05/07/2006 I want PAY PERIOD END to be 08/07/2006
and if DATE is 09/07/2006 I want PAY PERIOD END to be 22/07/2006 etc

How do I do this?

Kind Regards,

Matthew

View 1 Replies View Related

Calculating Column Totals

May 14, 2005

I have a table with revenue by contract imported from crystal reports. This data is then thrown in a query to match the contract with the corresponding account rep. The query is set to prompt the end user to enter the account rep name so that only revenue (and related data) is shown for that specific account rep. All that works great. My problem is that I need to show column totals by account rep in the query so that it can be exported to excel and emailed to each individual account rep on a weekly basis. Can someone please help me?

I appreciate any advice!

View 1 Replies View Related

Queries :: How To Distribute Different Values Of One Column In New Column Fields

Jan 30, 2014

In my table for duplicate "line no" I have different "contractor" like below.

LINE NO CONTRACTOR

L-0001 C-1000
L-0001 C-2000
L-0003 C-6000
L-0003 C-8000
L-0003 C-9000
L-0004 C-5000

Now I would like to make a query for transposing values like below:

LINE NO CONTRACTOR1 CONTRACTOR2 CONTRACTOR3

L-0001 C-1000 C-2000
L-0003 C-6000 C-8000 C-9000
L-0004 C-5000

how I have to make this query?

View 1 Replies View Related

Counting Distinct Values Of A Column Group By Another Column

Dec 4, 2011

I have this table ("people") and an example of possible rows:

id(key) COL 1 COL2 department country name
1 xx yy KPP USA John
2 zz kk KPP USA John
3 ss ff TLL USA John
4 ww qq PPO Italy Marco
5 jj uu PPO Italy Marco

I have to count the number of distinct DEPARTMENT for each NAME; so, for John should be 2 (KPP and TLL) and for Marco 1 (PPO).

I have tryed in this way:

SELECT
COUNT(DISTINCT department) AS NumberOfDifferentDepartments
FROM people
GROUP BY name;

But Access says me there is a syntax error.

I'm working with MS Access 2002.

View 2 Replies View Related

Calculating Values

May 2, 2006

I am not sure whether I posted in the right place but here's the deal: I have a form and a subform based on two tables and on the form I create a mathematical expression concerning a field which is based on another. The results are correct but of course the values in the table remain the same (null). Is there a way to have a formula in the table and then when I create the form based on that table to have the formula ready? BTW where are the data stored if they are not stored in that table?

View 1 Replies View Related

Calculating Values In A Text Box

Nov 24, 2005

Hi everyone

i have been struggling on this database that i am developing for a while and i haven't found a solution yet.

i have a Two tables

Table 1
"Attendance" with fields
Attendance ID,
Hours,
Group ID.

table 2
"Days" fields,
Day ID
Week beginning
Monday
Tuesday
Wednesday
Thursday
Friday
Hours

now i have created a form from these two tables, and what i wanted was each day of the week i will input a value under the day and i wanted it to be added up and then the result outputted to the "Hours" Box.

My dilema is that although i have figured out how to add up the fields in the form view by changing the Control source for the Hours box to something like
=[Monday]+[Tuesday]....[Friday]
this will only display the value in form view, the table will not update. i guess this is because the control source is not relating to te table anymore.

so if someone has some other ideas i would appreciate it.
regards
Yusef

View 3 Replies View Related

Calculating Values Vis-à-vis A Report

Aug 30, 2004

Just wondering if anybody could help me on this. I have encountered a problem in producing a report based on my main form (recordsource: tblStudents) and subform (recordsource:tblStudentsClasses), which are joined through their respective StudentID fields. My problem pertains to the fact that I just couldn’t seem to find a way to make my report produce a calculated value using an unbound control. I need it to show the average grade a student gets every semester by multiplying his individual class grades against its corresponding credit units and then add them together, and divide them against the sum total of that particular semester’s credit units. For example, a grade of 1.0 for psychology 101 multiplied by that subject’s 3 credit units + a grade of 2.0 for chemistry 101 multiplied by that subject’s 5 credit units and then divided by the sum total of those two subject’s credit units of 8.

I kinda find it complicated because each semester is made up of between 1 to 10 classes, so it would be inappropriate to just put the one average computation on a footer since each semester has to have an average grade of its own. Tried lots of procedure already and couldnt make anyone of them work. Another fact is that a credit unit of –3 and grade of 5.0 shouldn’t be included in the computation at all. And some of my data are supplied by combo boxes in the subform – cboCreditUnits and cboGrades (rowsources: tblClasses and tblGrades). How should I go about this all? Any ideas will be highly appreciated.

Thanks!

View 1 Replies View Related

AfterUpdate - Values Not Calculating

Apr 15, 2008

Below is the code I have created to calculate the values "CalcValue" and "CalcWork". The values for AssignValue, AssignPriority, Complex, Effort, Goal are all assigned by the selection made in the referred to/related combo boxes. However, the caluclated values return the concatonation of the intergers and not the sum of the integers. Additionally, if I am to use the CDec() function how do I specify the number of decimal places?

what am I missing here?

thanks!

Private Sub cboAssignPriority_AfterUpdate()

Dim CalcValue, AssignValue, AssignPriority, Complex, Effort, Goal, CalcWork As Integer

Value = 0
AssignValue = 0
AssignPriority = 0
CalcValue = 0
CalcWork = 0

AssignValue = Me!cboAssignValue.Column(3)
AssignPriority = Me!cboAssignPriority.Column(2)

Complex = cboDBObjectID.Column(2)
Effort = cboTaskTypeID.Column(3)
Goal = cboAgencyGoalID.Column(2)

Value = AssignValue + AssignPriority
CalcWork = Complex + Effort + Goal
CalcValue = CDec(Value)

CalcValue = Me!lngCalPriority

Debug.Print "Complex="; cboDBObjectID.Column(2)
Debug.Print "Effort="; cboTaskTypeID.Column(3)
Debug.Print "Goal="; cboAgencyGoalID.Column(2)
Debug.Print "AssignValue.Column(3)="; cboAssignValue.Column(3)
Debug.Print "AssignPriority.Column(2)="; cboAssignPriority.Column(2)
Debug.Print "Value ="; Value
Debug.Print "CalcValue ="; CalcValue
Debug.Print "CalcWork ="; CalcWork

End Sub

View 14 Replies View Related

Calculating Values From Subreports

Jun 16, 2006

I have a report that contains 3 subreports with a calculated total text box in each. I am trying to calculate the total of these text boxes from the subreports in the main report but I keep getting an error message (#Name?). Is it possible to calculate calculated sums from subreports in a main report?

View 1 Replies View Related

Queries :: How To Show Row Values As Column Values

Mar 8, 2015

I have a table with following two columns

TechName Version
SQLServer 2000
SQLServer 2003
SQLServer 2005
SQLServer 2008
SQLServer 2008R2
Oracle 11G
MSOffice 2000
MSOffice 2003
MSOffice 2007
MSOffice 2010

How can i show this data as components eqch version for a techname to be one component order need not follow

TechName Component1 Component2 Component3 Component4 Component5
SqlServer 2000 2003 2005 2008 2008R2
Oralce 11G NULL NULL NULL NULL
MSOffice 2000 2003 2007 2010 NULL

View 4 Replies View Related

Calculating And Storing New Values From Existing Ones

Jan 30, 2006

I am pretty new to access, I will get right to it.

I am scoring rating scales. I want to be able to enter just the responses from a person, say on 80 questions (preferably into a form), where all the answers are 0 to 3 and have Access add the questions into the right groups to calculate all the sub-scores of the rating scale.
For example, Scale A may consist of Questions 1, 6, 15, 29, 35, and 70
I need access to add those up and save them so I can use them in a report.
I also need access to add the frequency of certain questions that were responded to with the answer 3.
I have gotten Access to calculate the scores in a form by adding extra variables to the form, erasing the variable name out of the white box and putting in the syntax =[Q1]+[Q6]+[Q15], etc. in place of a variable name but it just sits there on the form and doesn't store it anywhere.
Thanks

View 2 Replies View Related

Calculating Daily Values For A Month

Jul 7, 2006

Hello all. I hope someone can lend a helping hand here. I am trying to create a query that will calculate a 24 hour value for every day of a month. For a month a go out a read meters. I need to get the difference of two readings by subtracting the first day from the second day and so on until I get to the end of the month. So, Day2-Day1=24 hour value, Day3-Day2, Day4- Day3... I have this in a spreadsheet but can't seem to grasp it for a query in a database. I would appreciate any help. Thanks.:confused: :D

View 1 Replies View Related

Calculating The Difference Between 2 'Time' Values

Nov 12, 2007

Hi, I wonder if someone can help me with the following problem:

I have a table with 2 columns,start time and end time, both containing time values in a four digit format, eg 0930 being 9:30am etc.

I have made a query to convert these into the standard format (eg 0930 becomes 09:30), using left/right and & functions.

Now I use the timevalue function to convert the string , eg 09:30m into a recongnised time value.

The problem is now I want to find the difference between the start and end times- but when i try a simple end_time - start_time formule it returns a long number which i dont understand, rather than just giving me the difference betwen the two times.

Im sure there is a simple way to do this which I dont know, can anyone help me out? Thanks in advance!

View 1 Replies View Related

Calculating The Difference Between 2 'Time' Values

Nov 12, 2007

Hi, I wonder if someone can help me with the following problem:

I have a table with 2 columns,start time and end time, both containing time values in a four digit format, eg 0930 being 9:30am etc.

I have made a query to convert these into the standard format (eg 0930 becomes 09:30), using left/right and & functions.

Now I use the timevalue function to convert the string , eg 09:30m into a recongnised time value.

The problem is now I want to find the difference between the start and end times- but when i try a simple end_time - start_time formule it returns a long number which i dont understand, rather than just giving me the difference betwen the two times.

Im sure there is a simple way to do this which I dont know, can anyone help me out? Thanks in advance!

View 1 Replies View Related

Reports :: Calculating Values In A Report

Jul 29, 2015

we have a field in a report, and currently, there is a text box with a control source of

=IIf([Flag1]="Capital",[Reserve]-Sum([Text52]),"")

They want me to add to it, where if [Text106]="0",[Reserve]-[Text52], otherwise it's [Text106]="0",[Reserve]-[Text106].I am able to do this second part OK with

=IIf([Text106]="0",[Reserve]-[Text52],[Reserve]-[Text106])

But then I lose the [Flag1]="Capital" part.

View 4 Replies View Related

Queries :: Calculating The Difference In Values In Two Different Records?

Aug 12, 2015

I have a query that must calculate the different between values in two different records, based on the date.

The underlying ORIGVALUES table contains:

Date; Value; Diff
1/10/15; 100; (this is what I am trying to calc)
1/11/15; 101; (this is what I am trying to calc)
1/14/15; 102; (this is what I am trying to calc)

What is the best way to have each record calculate the selected date value divided by the prior date value)? E.g.

For 1/11 the math is 101 / 100 (so the 1/11/15 record would show the result of 1.01)
For 1/14 the math is 102 / 101 (1/11 to 1/14 represents a weekend)

I could copy the prior day values to the current day records and do that math easily but that is very redundant.

View 5 Replies View Related

Queries :: Calculating And Returning Values From External Database?

Jan 2, 2014

I have created a link to a CRM system that we have, and am using access as an interface for a specific task with the data contained within this CRM.

I have written a query that pulls to fields of data together but cannot get the two to calculate.

Within SQL server management studio I use the following query to give me a numerical response.

SELECTPRCPRICE,SUM(CAST(VL2BENEFICIALASNUMERIC (20,6))*CAST(PRCPRICEAS MONEY)))ASHOLDINGVALUE

Access doesn't appear to accept the cast functionality / how I can perform a similar functionality with access?

View 9 Replies View Related

Showing Null Values When Calculating Days Passed?

Feb 24, 2012

I am using workdays to calculate time passed between two dates. I also have a table for Holidays that I don't want counted as work days. This is working well, but I would like my queries to show a null value instead of showing #Error when a date field is empty. Here is my coding in my Module.

Option Compare Database
Option Explicit
Public Function Workdays(ByRef startDate As Date, _
ByRef endDate As Date, _
Optional ByVal strHolidays As String = "Holidays" _
) As Integer

[code]....

View 3 Replies View Related

Queries :: Calculating Percentage - Exclude Null Values From Expression

Mar 10, 2014

I'm trying to create an expression to calculate percentage.

The fields, Value A and Value B might both have null values, but I do not want Access to treat nulls as zero (as in the Nz() fn). How do I get the expression to exclude any nulls and not calculate for those rows, but set the calculated value for a row with null A or B to zero.

I want it to set no calculated value to zero so I don't get overflow errors and can therefore order the data by the calculated field.

View 1 Replies View Related

Getting Values For Each Day From One Column

Aug 1, 2006

Hello!

I have problem designing query for table whitch have 4 columns(ID,Date,Name,Value). I have one record each day for station(Name).

Now I would like to get a difference between each day for a month. (See picture)

Thanks in advance!

View 2 Replies View Related

Column Values To Rows?

Aug 25, 2006

I am trying to devise a way to display query results in a row instead of a column. The table on which the query is built has this structure:

Column1: Index (pkf)
Column2: Group (int)
Column3: Position (int)
Column3: ItemCode (txt)

When I do a select query, the data comes back like this:

Group Position ItemCode
11A
12B
13C
14D
15E
16F
Etc.

I want to arrange the data this way:

1ABCDE (Etc)

I keep thinking that a cross-tab query is the answer, but all I seem to be able to do is to get counts of Position 1, 2, 3 Etc.

I’m baffled. Does anyone have a suggestion?

Thanks,

Rick

View 4 Replies View Related

Adding Values Within One Column

Mar 3, 2005

I've been having trouble trying to figure out how i can add the values within one column. I have a field named Cost, under that field i have serveral rows of data. I would like access to add all the numbers under that "cost" field. Im not sure how this is done. Can anyone please help ???

thanks
EM

View 6 Replies View Related

Queries :: Sum Of Values With Same ID In Column

Aug 14, 2013

I am having some trouble with a program that contains a query that is suppose to sum a bunch of market values that have the same ID and is from the same portfolio.

The problem I had at first was that some of these IDs and portfolios that should have been summed together had one called counterparty that had different values.

So the problem that occured was the following:

ID Portfolio CounterParty SumOfMarketValue
5224 SPAC Counterparty1 -55
5224 SPAC Counterparty2 -45

What I wanted

ID Portfolio SumOfMarketValue
5224 SPAC -100

So what I did was that I deleted that column, but I am guessing that the table somehow might save that they have this difference. How I can make them appear in the same sum?

View 3 Replies View Related

Group Column Headings And Sum Their Values

Jul 6, 2005

Hello,

can the following be done? :confused:

I have a one-rowed query, with the following column headings and values:

(see pic1)


I want similiar columns to be grouped and their respective values to be summed.
I.e.

(see pic2)

Can someone plese tell me how this is done in SQL?

I could just add the columns manually through the Design-View, but this would cause that new column headings that are added in the future to not be reflected in the query.

Jean

View 2 Replies View Related

Queries :: Multiplying Two Values From Same Column

Nov 26, 2013

Names Number1 Number2
Name1 1 2
Name1 2 1
Name1 3 -2
Name1 4 2
Name1 5 5
Name2 1 2
Name2 2 5
Name2 3 2
Name2 4 5
Name2 5 -1
...

For each Name, Number1 will always contain the values from 1 to 5. Number2 can vary, however.

I need constructing a query that, for each name, will look at the values in the Number2 column when Number1 is 1 or 2 and multiply them. So, the result I'm looking for is:

Name1 2
Name2 10

(Since 2 = 2 x 1 and 10 = 2 x 5)

I haven't had much look Googling (most search results involve multiplying two columns together, which isn't exactly what I'm after).

View 1 Replies View Related







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