I need to make a text box (txtfinal) that has an expression like this:
If "txt1" >8, then subtract 8 from "txt1"
and also if lstName is null then txtFinal is null also
"txt1" is a text box from a form that has a mathematical equation on it.
the final number is imported into the "txtFinal" if the number is greater
than 8 it needs to have 8 subtracted from it.
"lstName" is a list box on the same report with user name in it. It
references a specific user ID and Name from a form. (if this value is null,
then the "txtFinal" does not need to appear).
The key is that I cannot get the txtFinal to ONLY APPEAR IF NEEDED (if
txtName IS NOT Blank. I have tried for weeks to figure out the code to work
but cannot figure it out..... please help.....
tina - 16 Jan 2006 15:40 GMT
try
=IIf([1stName] Is Null, Null, IIf([txt1] > 8, [txt1] - 8, [txt1]))
hth
> I need to make a text box (txtfinal) that has an expression like this:
> If "txt1" >8, then subtract 8 from "txt1"
[quoted text clipped - 11 lines]
> txtName IS NOT Blank. I have tried for weeks to figure out the code to work
> but cannot figure it out..... please help.....
Marshall Barton - 16 Jan 2006 15:43 GMT
>I need to make a text box (txtfinal) that has an expression like this:
>If "txt1" >8, then subtract 8 from "txt1"
[quoted text clipped - 11 lines]
>txtName IS NOT Blank. I have tried for weeks to figure out the code to work
>but cannot figure it out..... please help.....
Try this kind of expression in the report text boxes:
=IIf(lstName Is Null, Null,
IIf(Forms!theform.Forms!theform.txt1 > 8,
Forms!theform.Forms!theform.txt1 - 8,
Forms!theform.Forms!theform.txt1))
But you will probably have to unravel the references because
I am not sure which items are on the form and which ones on
in the report. It would have helped me keep it straight if
you had provided the name of the form and report.

Signature
Marsh
MVP [MS Access]