By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,704 Members | 1,867 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,704 IT Pros & Developers. It's quick & easy.

Calculate totals from nested forms

P: n/a
Hi,
I have 3 nested forms and want to calculate a total on the first
subform (as the form loads)by adding 2 fields from that form
[deposit]+[rental] to a field on the second subform.
Second subform is [transactional subform] and control is Sumpd.
I use this

=[transactiontbl subform].Form!Sumpd+[deppd]+[rentpd]

which works well as long as the transactiontbl subform has records in
it. Problem is this subform will often be empty. I then get error as a
result in my calculated control. Have tried using Iif statements eg

=IIf(Me![transactiontbl
subform].Form.RecordCount=0,[deppd]+[rentpd],[transactiontbl
subform].Form!Sumpd+[deppd]+[rentpd])

but as a newbie am surely writing something wrong!
All forms are nested with master/child fields linked. Table
relationships also look OK.
Any help much appreciated.

Nov 13 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Try - Nz([transactiontbl subform].Form!Sumpd) + Nz(deppd) + Nz(rentpd)
I'm not sure it will work, but give it a go. Nz is used to convert Nulls to
Zeros.
Incidentally you don't need square brackets [] round field name or table
names PROVIDING there are no spaces in them. Makes expressions a little
simpler, but suggest you never use spaces in field name e.g. use
TransactionTblSubform

HTH

Phil

<on***********@hotmail.com> wrote in message
news:11*********************@g14g2000cwa.googlegro ups.com...
Hi,
I have 3 nested forms and want to calculate a total on the first
subform (as the form loads)by adding 2 fields from that form
[deposit]+[rental] to a field on the second subform.
Second subform is [transactional subform] and control is Sumpd.
I use this

=[transactiontbl subform].Form!Sumpd+[deppd]+[rentpd]

which works well as long as the transactiontbl subform has records in
it. Problem is this subform will often be empty. I then get error as a
result in my calculated control. Have tried using Iif statements eg

=IIf(Me![transactiontbl
subform].Form.RecordCount=0,[deppd]+[rentpd],[transactiontbl
subform].Form!Sumpd+[deppd]+[rentpd])

but as a newbie am surely writing something wrong!
All forms are nested with master/child fields linked. Table
relationships also look OK.
Any help much appreciated.

Nov 13 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.