A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

How do I add 5 seperate number entries into a single line total?



 
 
Thread Tools Display Modes
  #1  
Old February 15th, 2007, 04:05 PM posted to microsoft.public.access.queries
Tem
external usenet poster
 
Posts: 14
Default How do I add 5 seperate number entries into a single line total?

I have converted 5 separate field date entries into separate fields
converting them to a numeric value. I need to add each one to the other for a
total line entry. Each one looks for a date entry, then shows a number 1 for
it.
example: 1CapDateNbr: IIf([1Capdate]=Yes,"1"," ")
2CapDateNbr: IIf([2Capdate]=Yes,"1"," ")
3CapDateNbr: IIf([3Capdate]=Yes,"1"," ")
4CapDateNbr: IIf([4Capdate]=Yes,"1"," ")
5CapDateNbr: IIf([5Capdate]=Yes,"1"," ")
I need to add them together.
Thanks for your help.
  #2  
Old February 15th, 2007, 05:03 PM posted to microsoft.public.access.queries
John Spencer
external usenet poster
 
Posts: 7,815
Default How do I add 5 seperate number entries into a single line total?

Try returning a number, instead of a string.

5CapDateNbr: IIf([5Capdate]=Yes,1,0)

If 5Capdate is a boolean value then you could just add the five fields
together and use Abs to convert the negative value to a postive value
Abs(1CapDateNbr+2CapDateNbr+3CapDateNbr+4CapDateNb r+5CapDateNbr)

Based on the field names, I suspect that you really need to change your
table structure since this looks as if your data is not normalized.
--
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
..

"TEM" wrote in message
...
I have converted 5 separate field date entries into separate fields
converting them to a numeric value. I need to add each one to the other
for a
total line entry. Each one looks for a date entry, then shows a number 1
for
it.
example: 1CapDateNbr: IIf([1Capdate]=Yes,"1"," ")
2CapDateNbr: IIf([2Capdate]=Yes,"1"," ")
3CapDateNbr: IIf([3Capdate]=Yes,"1"," ")
4CapDateNbr: IIf([4Capdate]=Yes,"1"," ")
5CapDateNbr: IIf([5Capdate]=Yes,"1"," ")
I need to add them together.
Thanks for your help.



  #3  
Old February 15th, 2007, 05:27 PM posted to microsoft.public.access.queries
Tem
external usenet poster
 
Posts: 14
Default How do I add 5 seperate number entries into a single line tota

Thanks John, I'll give that a try. I recently enherited this database and am
trying to make it work, but the more I work with it, the more I see the need
to make alot of sturcture changes. Thanks again

"John Spencer" wrote:

Try returning a number, instead of a string.

5CapDateNbr: IIf([5Capdate]=Yes,1,0)

If 5Capdate is a boolean value then you could just add the five fields
together and use Abs to convert the negative value to a postive value
Abs(1CapDateNbr+2CapDateNbr+3CapDateNbr+4CapDateNb r+5CapDateNbr)

Based on the field names, I suspect that you really need to change your
table structure since this looks as if your data is not normalized.
--
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
..

"TEM" wrote in message
...
I have converted 5 separate field date entries into separate fields
converting them to a numeric value. I need to add each one to the other
for a
total line entry. Each one looks for a date entry, then shows a number 1
for
it.
example: 1CapDateNbr: IIf([1Capdate]=Yes,"1"," ")
2CapDateNbr: IIf([2Capdate]=Yes,"1"," ")
3CapDateNbr: IIf([3Capdate]=Yes,"1"," ")
4CapDateNbr: IIf([4Capdate]=Yes,"1"," ")
5CapDateNbr: IIf([5Capdate]=Yes,"1"," ")
I need to add them together.
Thanks for your help.




 




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 Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 04:27 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.