Using IIF on a Form's unbound fields...?

  • Thread starter Thread starter Vince
  • Start date Start date
V

Vince

Hello,

I initially had this in a query....

Refund: IIf([TotalFundsOutsandingRemain]>0,
[TotalFundsOutsandingRemain],"")


And in another I set....

Balance Owing: IIf([TotalFundsOutsandingRemain]<0,
[TotalFundsOutsandingRemain],"")



Is there any way to use these codes in a form on an
unbound field? I just want the total to show up in Refund
or Balance depending if the total is greater or less than
zero.....

I am not an ADVANCED COder as you may notice...
Thanks!

Vince
 
I think you will not have a problem setting it up the way you want.
Add 2 unbound text boxes to your form, say, txtOwing and txtRefund.
In the Currnet event of the form, put:

if Me!TotalFundsOutsandingRemain > 0 then
txtRefund = Me!TotalFundsOutsandingRemain
else
txtOwing = Me!TotalFundsOutsandingRemain
end if

You can use a single text box (txtResult) and simply change the color of
the text to indicate if it is a Refund or Owing:

if Me!TotalFundsOutsandingRemain > 0 then
txtResult.ForeColor = 0
else
txtResult.ForeColor = 255
end if
txtResult = Me!TotalFundsOutsandingRemain

I assumed that TotalFundsOutsandingRemain is a field in the table or
query that your form is based on.
Good luck,
Pavel
 
Thanks!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

I will give it a try!
-----Original Message-----
I think you will not have a problem setting it up the way you want.
Add 2 unbound text boxes to your form, say, txtOwing and txtRefund.
In the Currnet event of the form, put:

if Me!TotalFundsOutsandingRemain > 0 then
txtRefund = Me!TotalFundsOutsandingRemain
else
txtOwing = Me!TotalFundsOutsandingRemain
end if

You can use a single text box (txtResult) and simply change the color of
the text to indicate if it is a Refund or Owing:

if Me!TotalFundsOutsandingRemain > 0 then
txtResult.ForeColor = 0
else
txtResult.ForeColor = 255
end if
txtResult = Me!TotalFundsOutsandingRemain

I assumed that TotalFundsOutsandingRemain is a field in the table or
query that your form is based on.
Good luck,
Pavel
Hello,

I initially had this in a query....

Refund: IIf([TotalFundsOutsandingRemain]>0,
[TotalFundsOutsandingRemain],"")

And in another I set....

Balance Owing: IIf([TotalFundsOutsandingRemain]<0,
[TotalFundsOutsandingRemain],"")

Is there any way to use these codes in a form on an
unbound field? I just want the total to show up in Refund
or Balance depending if the total is greater or less than
zero.....

I am not an ADVANCED COder as you may notice...
Thanks!

Vince
.
 
Back
Top