Simple Calculation using the Currency Data Type

H

Hank

I have a form with a list of textboxes that have values (Currency dataType).
All I want to do is add up the values. Even simple syntax fails WTF

Ex: Me. TxtTotals = Me.Text188 + Me.Text189

Fails..... Why?????

I've done really complicated calcs on Number data Types but this is 1st.
attempt at Currency. Help me out Please....
 
F

fredg

I have a form with a list of textboxes that have values (Currency dataType).
All I want to do is add up the values. Even simple syntax fails WTF

Ex: Me. TxtTotals = Me.Text188 + Me.Text189

Fails..... Why?????

I've done really complicated calcs on Number data Types but this is 1st.
attempt at Currency. Help me out Please....

What exactly do you mean by 'fails'?
Do you get an incorrect result? No result? An Error Message?

As a guess, most likely it 'fails' because one of the field's might be
Null.
Null + a value = Null.

Use the Nz() function.
Me.[TxtTotals] = Nz(Me.[Text188],0) + Nz(Me.[Text189],0)

Note.. This problem would be the same whether the field datatype is
Currency or Number.
 
H

Hank

Fails as in no result and yes there are some nulls thanks.

fredg said:
I have a form with a list of textboxes that have values (Currency dataType).
All I want to do is add up the values. Even simple syntax fails WTF

Ex: Me. TxtTotals = Me.Text188 + Me.Text189

Fails..... Why?????

I've done really complicated calcs on Number data Types but this is 1st.
attempt at Currency. Help me out Please....

What exactly do you mean by 'fails'?
Do you get an incorrect result? No result? An Error Message?

As a guess, most likely it 'fails' because one of the field's might be
Null.
Null + a value = Null.

Use the Nz() function.
Me.[TxtTotals] = Nz(Me.[Text188],0) + Nz(Me.[Text189],0)

Note.. This problem would be the same whether the field datatype is
Currency or Number.
 
Top