View Full Version : Total field 'a' if field 'b' =1 in a subform!


hardy1976
04-27-2006, 02:46 AM
Hi, HELP!!!

I'm trying to find a way of totaling field a if field b = 1 for example, however I cannot get it to work, I think the fact that the form I am trying to find this sum for is in a sub form is not helping!

Any ideas?

Regards
H.

PS both fields are in a subform!

KenHigg
04-27-2006, 03:49 AM
If you are doing this ina subform footer, you should be able to do something like:

=sum([MyFldName])


???

hardy1976
04-27-2006, 03:58 AM
Thanks, cracked it!

Just could not get it to work, was banging my head against a brick wall for about three hours!!!

=DSum("[variation]","[job sheet]","[creditnumber] = 2")

Cheers
H

KenHigg
04-27-2006, 04:07 AM
Cool - Glad you got it working. :)

hardy1976
05-02-2006, 08:25 AM
Hi,

Second part of the problem has arisen!!!!

DSUM seems to be summing all the instance where there is "2"

However I need it to sum only in the current recordset that is in my subform!

Any ideas?

H.

KenHigg
05-02-2006, 09:17 AM
Looks like you should be using simple a sum instead of a dsum...

Maybe:

=Sum("[variation]")

hardy1976
05-03-2006, 09:06 AM
Thanks for the info!

However... used the DSum but added some Criteria, many thanks for the help.

I did try using the sum method however it didnt work (well may be I was just not clever enough to work out how to do it!)

Over come that, now I found one of my relationships doesnt work correctly! Oh well leave that one til Wednesday!

H.