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  dBforums > PC based Database Applications > Microsoft Access > calculating remaining value in one field, based on second field

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 10-08-11, 03:32
philfr philfr is offline
Registered User
 
Join Date: Oct 2011
Posts: 2
Angry calculating remaining value in one field, based on second field

Hello all,

I am trying to calculating the remaining value in one field, based on second (Boolean) field in the same table.

"Table1" data

Row1 data: F1, F2, F3, 24, True (F= Field)
Row2 data: F1, F2, F3, 10, False
Row3 data: F1, F2, F3, 3, False

I want to my query to display F1, F2, F3, 11

I am using Access 2003

I have no idea where to start.
many thanks
Philfr
Reply With Quote
  #2 (permalink)  
Old 10-08-11, 04:07
Sinndho Sinndho is offline
Registered User
 
Join Date: Mar 2009
Posts: 3,446
Basically (with F4 being the numeric column and F5 the boolean column):
Code:
SELECT Sum(IIf([F5]=True,[F4],[F4]*-1)) AS Total
FROM Table1;
But you don't explain how to group the values in F1, F2, F3.
__________________
Have a nice day!
Reply With Quote
  #3 (permalink)  
Old 10-09-11, 06:20
philfr philfr is offline
Registered User
 
Join Date: Oct 2011
Posts: 2
thanks

Thanks Sinndho,
works like a dream. the other fields aren't important, I can group on the one I want.
It gives me exactly what I want.
cheers
Reply With Quote
  #4 (permalink)  
Old 10-09-11, 15:15
Sinndho Sinndho is offline
Registered User
 
Join Date: Mar 2009
Posts: 3,446
You're welcome!
__________________
Have a nice day!
Reply With Quote
Reply

Tags
query

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On