dbTalk Databases Forums  

Unique total for each row

comp.databases.ms-access comp.databases.ms-access


Discuss Unique total for each row in the comp.databases.ms-access forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
tony.stevens5@gmail.com
 
Posts: n/a

Default Unique total for each row - 02-28-2008 , 03:55 PM






Hi

Apologies if this is not in the right area but first time for posting
here.

I know how to add up amounts on a form to create a total for a line
but the database i am working on needs the total to be unique for each
row i put amounts in. What is happening is that when i put in amounts
in row 2 then it adds that along with row 1...etc etc.

On the form i put in the unbound box (called Total) the following
code...

=Sum([example1]+[example2]-[example3]) This, as stated above will
give a total amount. Example is not the name of the fields but only
used to show the format of the code i have used.

Could one of you Access gurus take the above and show me the correct
format so each row keeps its own totals; hopefully using the same
unbound box for Total on the form....unless what i require as to be
done using a query of Crosstab.

Queries are not a problem for me if they have to be used but i have
never used CrossTabs yet so please give me clear instructions if that
is the only/best route to take....or give me the form version to get
going and another method so i have something to look forward to if its
a better route to take.

Your help is appreciated.

Thankyou.

Tony


Reply With Quote
  #2  
Old   
Allen Browne
 
Posts: n/a

Default Re: Unique total for each row - 02-28-2008 , 08:14 PM






Remove the Sum() part, i.e. use:
=[example1]+[example2]-[example3]

If any one of the fields is null, that expression will be null, so you
probably want to use Nz() to convert each null into a zero:
=Nz([example1],0) + Nz([example2],0) - Nz([example3],0)

If you have lots of fields like that, you have designed a spreadsheet. In a
relational database, these should be many records in a related table rather
than many fields in one table. To read further about that, see:
http://allenbrowne.com/casu-22.html
and click on the link for #3, "Normalizing Data."

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

<tony.stevens5 (AT) gmail (DOT) com> wrote

Quote:
Apologies if this is not in the right area but first time for posting
here.

I know how to add up amounts on a form to create a total for a line
but the database i am working on needs the total to be unique for each
row i put amounts in. What is happening is that when i put in amounts
in row 2 then it adds that along with row 1...etc etc.

On the form i put in the unbound box (called Total) the following
code...

=Sum([example1]+[example2]-[example3]) This, as stated above will
give a total amount. Example is not the name of the fields but only
used to show the format of the code i have used.

Could one of you Access gurus take the above and show me the correct
format so each row keeps its own totals; hopefully using the same
unbound box for Total on the form....unless what i require as to be
done using a query of Crosstab.

Queries are not a problem for me if they have to be used but i have
never used CrossTabs yet so please give me clear instructions if that
is the only/best route to take....or give me the form version to get
going and another method so i have something to look forward to if its
a better route to take.


Reply With Quote
  #3  
Old   
tony.stevens5@gmail.com
 
Posts: n/a

Default Re: Unique total for each row - 02-28-2008 , 11:56 PM



Hello Allen

Thanks for the help.

My database uses two tables, the main uses a list of staff where the
staff number is unique and that is linked to staff number in the
subform where it can be repeated...hence why staff are repeated when
more than 1 claim is put in. Even though i have learnt more about
Access over the year there are just little bits where a good example
can work wonders....or help where other are willing to help others,
like here.

I would like to know more about CrossTabs and i'm sure that will come
about eventually. Do you know of any site where you can use examples
so you can work on particular areas of Access, CrossTabs in this case?


Once again, thank you.

Reply With Quote
  #4  
Old   
Allen Browne
 
Posts: n/a

Default Re: Unique total for each row - 02-29-2008 , 01:22 AM



<tony.stevens5 (AT) gmail (DOT) com> wrote

Quote:
I would like to know more about CrossTabs and i'm sure that will come
about eventually. Do you know of any site where you can use examples
so you can work on particular areas of Access, CrossTabs in this case?
Here's a starting point:
Crosstab query techniques
at:
http://allenbrowne.com/ser-67.html

You can create the example query using the Northwind sample database that
installs with Access.

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.