473,388 Members | 1,496 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,388 software developers and data experts.

Help with calculation in MS Access

Hi I wonder if anyone could help me with my grand-daughters home work?

We are using a form to add data about personnel who work for our imaginary
company.

Each record has the employee's ID, Name, Job title, and the amount on money
we have supposed to have given him/her in the current month.

Is there a way of showing (in a separate box), how much the running total
would be, i.e how much money he would have received from the company in the
last three months?

Cheers
Keith
Nov 13 '05 #1
8 1428
pUT FOLLOWING IN QUERY
(or use a report to get running totals)

SELECT t1.KeyField, (SELECT Sum(t2.Amount) FROM YourTable AS t2 WHERE
t2.KeyField<=t1.KeyField) AS RunBal FROM YourTable AS t1 ORDER BY
t1.KeyField;
Alfred

"Keith Robinson" <Ke**************@ntlworld.com> wrote in message
news:W3***************@newsfe1-win.ntli.net...
Hi I wonder if anyone could help me with my grand-daughters home work?

We are using a form to add data about personnel who work for our imaginary
company.

Each record has the employee's ID, Name, Job title, and the amount on
money we have supposed to have given him/her in the current month.

Is there a way of showing (in a separate box), how much the running total
would be, i.e how much money he would have received from the company in
the last three months?

Cheers
Keith

Nov 13 '05 #2
Are you really only entering data for one month?
In that case, your "running total" would simply be 3 * the amount for the
current month.
Assuming that the field in your table is named Payment, you could set the
ControlSource of your separate textbox like this:
= [Payment] * 3

If you're actually entering records for several months, I'd recommend
splitting your table into two - one for Employees (ID, Name, Job), and one
for Payments (ID, PayDate, Amount).
Then we'd need to know why you said 3 months.
Do you really only want to know about the last 3 months?
Or do you only have 3 months of data, and what you want is the total of
whatever you have?

Perhaps your grand-daughter can answer some of these questions.
"Keith Robinson" <Ke**************@ntlworld.com> wrote in message
news:W3***************@newsfe1-win.ntli.net...
Hi I wonder if anyone could help me with my grand-daughters home work?

We are using a form to add data about personnel who work for our imaginary
company.

Each record has the employee's ID, Name, Job title, and the amount on money we have supposed to have given him/her in the current month.

Is there a way of showing (in a separate box), how much the running total
would be, i.e how much money he would have received from the company in the last three months?

Cheers
Keith

Nov 13 '05 #3


Hi Thanks for your help.

The three months was only an example, we want a continuing running
total.

In the Forms control box I did add =[Payment]*3 this did not work.

Could I not do this in a query? again I tried and failed, I'm not great
at this I'm afraid.

Thanks again
Keith


*** Sent via Developersdex http://www.developersdex.com ***
Nov 13 '05 #4


Hi Thanks for the reply, I will try your suggestion.

Cheers
Keith

*** Sent via Developersdex http://www.developersdex.com ***
Nov 13 '05 #5


Hi Sorry
I'm not explaining myself very well with this problem.
But basically I have a table with a field named "Income".

Each time we pay an employee money, the amount is entered into the
"Income" field. which could look some thing like this..

Income
500
300
1000
150
450 If this column was added up it would come to 2400

We have also created a Form. In this there are two text boxes, one to
add data i.e the amount money I am giving the employee at this time
(this will transfer to the Income field in our table).

in the other text box (named Total Income) I would like the total income
we have give to this employee thoughout the year to appear.

So for example If I give an employee £100, I would then like the Total
Income text box to change from 2400 (as above) to 2500.

Maybe this is not possible.

Thanks Keith

*** Sent via Developersdex http://www.developersdex.com ***
Nov 13 '05 #6
Keith Robinson wrote:
Hi Sorry
I'm not explaining myself very well with this problem.
But basically I have a table with a field named "Income".

Each time we pay an employee money, the amount is entered into the
"Income" field. which could look some thing like this..

Income
500
300
1000
150
450 If this column was added up it would come to 2400

We have also created a Form. In this there are two text boxes, one to
add data i.e the amount money I am giving the employee at this time
(this will transfer to the Income field in our table).

in the other text box (named Total Income) I would like the total
income we have give to this employee thoughout the year to appear.

So for example If I give an employee £100, I would then like the Total
Income text box to change from 2400 (as above) to 2500.

Maybe this is not possible.


Check help file for the DSum() function.

=DSum("Income", "YourTableName", "EmployeeID = " & Me.EmployeeID & " AND
PaymentDate > #" & DateSerial(Year(Date())-1, 12, 31) & "#")

Expression explained:
Find the sum of the field [Income] from the table "YourTableName" for the
employee currently displayed on the form and where the date of payment is
greater than December 31st of last year.

Now, I made some assumptions in the example. One is that you have a field that
identifies the employee. I named mine EmployeeID and the expression above
assumes this is a numeric value. If it were text I would need single quote
delimiters around that criteria value similar to the way I used # delimiters
around the date criteria.

Much of the difficulty of setting up a DSum() expression like above is getting
all of the delimiters and quote-breaks correct. If you have trouble post back.

--
I don't check the Email account attached
to this message. Send instead to...
RBrandt at Hunter dot com

Nov 13 '05 #7
Keeping things simple for you at the moment:

Form bound to Income table. Income table contains "Income" Field.
TextBox named Text1 on Form.
In the control source of Text1 put:

=Sum([Income])

In the "AfterUpdate" event of the textbox where you enter the money,
put the following in the sub

Me.requery
osmethod

Nov 13 '05 #8


Hi again, thanks that worked great.

Each time I enter a figure the total income appears in the text box,
which is fanstastic, but is there anyway that the text box will
calculate just 28 days then reset, so it will then begin to calulate the
next 28 days? or am I now asking too much.

Thanks for all your help

Cheers
Keith

*** Sent via Developersdex http://www.developersdex.com ***
Nov 15 '05 #9

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

Similar topics

3
by: Enterprise | last post by:
I use MS ACCESS front end back end design. Multiple computers. There is a form that uses a table for calculation purposes. When ever the table is open on one computer, the form does not work...
0
by: leavandor | last post by:
I am trying to design a query that works with a relationship between a Table and a Query. I am comparing a value in the table with a computed value inside the query. The reason for this is that...
0
by: gavo | last post by:
Hi. using A2K; i have a form containing a continous subform. The question is, how can i call a calculation for one of the fields in the continous subform from the main form. At the moment i...
13
by: Fao | last post by:
Hello, I am having some problems with inheritance. The compiler does not not return any error messages, but when I execute the program, it only allows me to enter the number, but nothing else...
1
by: jlf | last post by:
Need serious help with a calculation. The fields are based on a query that has linked many different tables. The calculation I currently have is: =sum()/((+)*(Piecesnum])) It is giving a...
7
by: Siv | last post by:
Hi, I have a stored procedure that I want to execute and then wait in a loop showing a timer whilst it completes and then carry on once I get notification that it has completed. The main reason...
2
by: martin | last post by:
Hello, Today I fetched the standard Access-2003 template "orders management db" from http://office.microsoft.com/en-au/templates/TC010185481033.aspx?pid=CT101426031033 In de openingform one...
1
by: ABHICA2004 | last post by:
Presently I'm dealing with a data base with the structure as under: 1.Source document is an excel file which contains thousands of rows ( item)& multiple columns ( relating to each individual...
3
by: heckstein | last post by:
I have created a query in MS Access 2003 that is pulling training records for our company that includes training hour calculation. One field I am pulling is the instructor name. Many courses have...
2
by: hcaptech | last post by:
This is my Test.can you help me ? 1.Which of the following statement about C# varialble is incorrect ? A.A variable is a computer memory location identified by a unique name B.A variable's name...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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,...
0
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...

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.