Null value in report

N

Nine Doors

Hi Everyone,
Quick question here. I know this can be done as I've done
it before, but for the life of me, I can't figure it out.
Here's the problem. In access2000, have a report that
takes the total of fieldA, and subtracts from it fieldB
and then displays the result in another textbox. Pretty
straighforward stuff. However fieldB (the one which gets
subtracted) does not always have a value in it. (There is
no default "0.00") When there is no value there, the
report just completely abandons the formula, and displays
nothing. Does anyone know of a piece of code I can insert
into the formula in the textbox, that will consider a null
value as 0 and continue with the calculation? Or if
there'a a better way to get around this?

I've tried changing the default value for the field, but
keep getting stupid error message "Out of space or no
memory available, changes cannot be saved" (Which is
totally untrue)
Any help would be appreciated!

Thx in advance everyone,

Niner
 
A

Allen Browne

Nz() should do the trick. Something like this:
=Nz([Credits], 0) - Nz([Debits], 0)
 
G

Guest

That did the trick! Thanks!
One last quicky (if you have a half a sec..) Any chance
you've got another trick up your sleeve to display 0, for
that FieldB when it has nothing to display? Currently
shows nothing, if there's no value. User may find it
confusing...:-(

Sorry to be a pain,

Thanks again,

Niner


-----Original Message-----
Nz() should do the trick. Something like this:
=Nz([Credits], 0) - Nz([Debits], 0)

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Hi Everyone,
Quick question here. I know this can be done as I've done
it before, but for the life of me, I can't figure it out.
Here's the problem. In access2000, have a report that
takes the total of fieldA, and subtracts from it fieldB
and then displays the result in another textbox. Pretty
straighforward stuff. However fieldB (the one which gets
subtracted) does not always have a value in it. (There is
no default "0.00") When there is no value there, the
report just completely abandons the formula, and displays
nothing. Does anyone know of a piece of code I can insert
into the formula in the textbox, that will consider a null
value as 0 and continue with the calculation? Or if
there'a a better way to get around this?

I've tried changing the default value for the field, but
keep getting stupid error message "Out of space or no
memory available, changes cannot be saved" (Which is
totally untrue)
Any help would be appreciated!

Thx in advance everyone,

Niner


.
 
A

Allen Browne

Set the Format property of the text box to something like:
0;-0;0;0

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

That did the trick! Thanks!
One last quicky (if you have a half a sec..) Any chance
you've got another trick up your sleeve to display 0, for
that FieldB when it has nothing to display? Currently
shows nothing, if there's no value. User may find it
confusing...:-(

Sorry to be a pain,

Thanks again,

Niner
-----Original Message-----
Nz() should do the trick. Something like this:
=Nz([Credits], 0) - Nz([Debits], 0)


Hi Everyone,
Quick question here. I know this can be done as I've done
it before, but for the life of me, I can't figure it out.
Here's the problem. In access2000, have a report that
takes the total of fieldA, and subtracts from it fieldB
and then displays the result in another textbox. Pretty
straighforward stuff. However fieldB (the one which gets
subtracted) does not always have a value in it. (There is
no default "0.00") When there is no value there, the
report just completely abandons the formula, and displays
nothing. Does anyone know of a piece of code I can insert
into the formula in the textbox, that will consider a null
value as 0 and continue with the calculation? Or if
there'a a better way to get around this?

I've tried changing the default value for the field, but
keep getting stupid error message "Out of space or no
memory available, changes cannot be saved" (Which is
totally untrue)
Any help would be appreciated!

Thx in advance everyone,

Niner


.
 
Top