Text box contains #Error regarding sum value

C

Chlaris

Dear all,

I have a main form and subform

Main form : frmListInvoiceMain
Subform : frmListInvoiceDetail

In the form footer of frmListInvoiceDetail, I have a text box :

Name : txtSumOfAmount
Control Source : =Sum([Amount])

In the form footer of frmListInvoiceMain, I have a text box :

Name : txtTotal
Control Source : =[frmListInvoiceDetail].[Form]![txtSumOfAmount]

The record source of frmListInvoiceDetail is retrieved from union query.

If there are record(s) in the subform, txtTotal works fine.
But if there is no record in the subform, txtTotal return #Error

How to solve this problem ?
Thanks.

Chlaris
 
B

boblarson

Use the NZ function:


Name : txtSumOfAmount
Control Source : =Sum(Nz([Amount],0))
 
C

Chlaris

Using the NZ function doesn't work.
Thanks.

boblarson said:
Use the NZ function:


Name : txtSumOfAmount
Control Source : =Sum(Nz([Amount],0))


--
Bob Larson
Access World Forums Super Moderator
____________________________________
If my post was helpful to you, please rate the post.


Chlaris said:
Dear all,

I have a main form and subform

Main form : frmListInvoiceMain
Subform : frmListInvoiceDetail

In the form footer of frmListInvoiceDetail, I have a text box :

Name : txtSumOfAmount
Control Source : =Sum([Amount])

In the form footer of frmListInvoiceMain, I have a text box :

Name : txtTotal
Control Source : =[frmListInvoiceDetail].[Form]![txtSumOfAmount]

The record source of frmListInvoiceDetail is retrieved from union query.

If there are record(s) in the subform, txtTotal works fine.
But if there is no record in the subform, txtTotal return #Error

How to solve this problem ?
Thanks.

Chlaris
 
B

boblarson

Have you figured this out? I am surprised that the NZ function did not work
for you. But, if it didn't then are you sure that your text box that houses
AMOUNT is named differently than the field?
--
Bob Larson
Access World Forums Super Moderator
Utter Access VIP
Tutorials at http://www.btabdevelopment.com
__________________________________
If my post was helpful to you, please rate the post.


Chlaris said:
Using the NZ function doesn't work.
Thanks.

boblarson said:
Use the NZ function:


Name : txtSumOfAmount
Control Source : =Sum(Nz([Amount],0))


--
Bob Larson
Access World Forums Super Moderator
____________________________________
If my post was helpful to you, please rate the post.


Chlaris said:
Dear all,

I have a main form and subform

Main form : frmListInvoiceMain
Subform : frmListInvoiceDetail

In the form footer of frmListInvoiceDetail, I have a text box :

Name : txtSumOfAmount
Control Source : =Sum([Amount])

In the form footer of frmListInvoiceMain, I have a text box :

Name : txtTotal
Control Source : =[frmListInvoiceDetail].[Form]![txtSumOfAmount]

The record source of frmListInvoiceDetail is retrieved from union query.

If there are record(s) in the subform, txtTotal works fine.
But if there is no record in the subform, txtTotal return #Error

How to solve this problem ?
Thanks.

Chlaris
 
C

Chlaris

The sum text box works fine if there is any record in the subform.
Thx.

boblarson said:
Have you figured this out? I am surprised that the NZ function did not
work
for you. But, if it didn't then are you sure that your text box that
houses
AMOUNT is named differently than the field?
--
Bob Larson
Access World Forums Super Moderator
Utter Access VIP
Tutorials at http://www.btabdevelopment.com
__________________________________
If my post was helpful to you, please rate the post.


Chlaris said:
Using the NZ function doesn't work.
Thanks.

boblarson said:
Use the NZ function:


Name : txtSumOfAmount
Control Source : =Sum(Nz([Amount],0))


--
Bob Larson
Access World Forums Super Moderator
____________________________________
If my post was helpful to you, please rate the post.


:

Dear all,

I have a main form and subform

Main form : frmListInvoiceMain
Subform : frmListInvoiceDetail

In the form footer of frmListInvoiceDetail, I have a text box :

Name : txtSumOfAmount
Control Source : =Sum([Amount])

In the form footer of frmListInvoiceMain, I have a text box :

Name : txtTotal
Control Source : =[frmListInvoiceDetail].[Form]![txtSumOfAmount]

The record source of frmListInvoiceDetail is retrieved from union
query.

If there are record(s) in the subform, txtTotal works fine.
But if there is no record in the subform, txtTotal return #Error

How to solve this problem ?
Thanks.

Chlaris
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top