Sum help

astarbyfar

Registered User.
Local time
Today, 05:02
Joined
Apr 27, 2003
Messages
93
Apoligies for this rather frivilous question but IM getting really annoyed with this and I have attempted to serach the forum! I have four fields Outer1, Outer2, Outer 3 and Outer4 and I want to get the total of the four fields in a new field called total outer. However I want the user to be able to see the number being calculated as each number is recorded on the data entry form! I.e. so if the user enters 10 into the Outer1 field the total outer will display 10 e.t.c. As ive said I have tried seearching the forum but each time i type calculation or sum in forms it returns information on calculating the sum of just one field.

P.S. If anyone does know could they tell me where to type the relevent command.
 
Do the sum in the query like this:

Outer_Total: (Nz([Outer1])+Nz([Outer2])+Nz([Outer3])+Nz([Outer4]))
 
...

Have a look at this.
The form Reken does what you questioned.



...
 

Attachments

Still no luck!

Sorry people but Ive still not managed to work it. Both examples do not work. As I said I need to be able to see the data being manipulated. Also in the table ive created the field Outer total which should save the calculated field into the database. Thanks for the suggestions but if anyone else has any please help!
 
Sorted

Ive been able to sort the previous problem all I had to do is type =([Outer rear left]+[Outer rear right]+[Outer front right]+[Outer front left]) in the control source and it worked. However I have a new problem the above command will only work for a number data type. However in some cases not all fields are used and I need to be able to display NA in the there which is a text string as a result the above command produces a concatenation of the data entered into each. Is there any way i can alter the above to allow a text input. Regards
 
Hi, has anyone any ideas how we can add up the values in a textbox when the field type is a 'text' type?
 
You've actually got basic design problems, it looks as if you're trying to re-create a spreadsheet in Access. You shouldn't store the calculated total either. Search here for normalisation/normalization topics
 
No Im not trying to store the total in the databse! Ive simply used the terminology as an indication. Howvever I still need to calculate the total of a text field, the reason being when the form is loaded the user must see a ? in the tetxt box to indicate that the field requires information
 
Rather than using a ? - why not make the fields to fill in a different colour?Then you can have them as numbers.

You can add code at the end to make sure the've got a value in them.

Col
 
astarbyfar said:
No Im not trying to store the total in the databse! Ive simply used the terminology as an indication. Howvever I still need to calculate the total of a text field, the reason being when the form is loaded the user must see a ? in the tetxt box to indicate that the field requires information

I agree with Colin, if you need to do arithmetic on a field it should be a number. There are many different ways to indicate that a field need input.

If you are so set on displaying a question mark how about this:

Create a label that fits over the actual textbox that has a question mark in it. In the On Current event of the form use code like:

IF Me!txtNumber = 0 Then
Me!lblQuestionMark.Visible = True
Else
Me!lblQuestionMark.Visible = False
End If

In the On Click event of the label use:

Me!lblQuestionMark.Visible = False
Me!txtNumber.Setfocus

So the user sees the question mark, clicks it and the question mark disappears and the focus is in the text control so they can enter a number.
 

Users who are viewing this thread

Back
Top Bottom