iff, then, else textbox help!!!

C

clawdogs

Hi I got the following to work in a text box if DECTOV (textbox) is
greater than 1. My poblem is that if DECTOV is not greater than 1 I
get a blank box. How do I get it to show zero if DECTOV is not
greater than 1? The code below will calculate 3 text boxes if DECTOV
is greater than 1.

=IIf([DECTOV1000]>1,[EMPLOYEE DATA subform].Form!TOVCOMP2)*
([PERCENTOVDEC])*([DECRATE])
 
D

Dorian

Put ',0' at the end, e.g.:
DECRATE],0)
Look up the syntax for IIF in Access Help.
-- Dorian
"Give someone a fish and they eat for a day; teach someone to fish and they
eat for a lifetime".
 
D

Douglas J. Steele

The IIf statement actually accepts 3 parameters: the boolean condition, what
to do if the boolean condition is True, and what to do if the boolean
condition is False. Provide 0 as the third parameter:

=IIf([DECTOV1000]>1,[EMPLOYEE DATA
subform].Form!TOVCOMP2)*([PERCENTOVDEC])*([DECRATE], 0)
 
C

clawdogs

The IIf statement actually accepts 3 parameters: the boolean condition, what
to do if the boolean condition is True, and what to do if the boolean
condition is False. Provide 0 as the third parameter:

=IIf([DECTOV1000]>1,[EMPLOYEE DATA
subform].Form!TOVCOMP2)*([PERCENTOVDEC])*([DECRATE], 0)

--
Doug Steele, Microsoft Access MVPhttp://I.Am/DougSteele
(no e-mails, please!)




Hi I got the following to work in  a text box if DECTOV (textbox) is
greater than 1.  My poblem is that if DECTOV is not greater than 1 I
get a blank box.  How do I get it to show zero if DECTOV is not
greater than 1?  The code below will calculate 3 text boxes if DECTOV
is greater than 1.
=IIf([DECTOV1000]>1,[EMPLOYEE DATA subform].Form!TOVCOMP2)*
([PERCENTOVDEC])*([DECRATE])- Hide quoted text -

- Show quoted text -

Hi Thanks for your help, but that doesn't seem to work. That was the
first thing I initially tried before posting on this board. It still
shows up blank.
 
C

clawdogs

The IIf statement actually accepts 3 parameters: the boolean condition,what
to do if the boolean condition is True, and what to do if the boolean
condition is False. Provide 0 as the third parameter:
=IIf([DECTOV1000]>1,[EMPLOYEE DATA
subform].Form!TOVCOMP2)*([PERCENTOVDEC])*([DECRATE], 0)
Hi I got the following to work in  a text box if DECTOV (textbox) is
greater than 1.  My poblem is that if DECTOV is not greater than 1 I
get a blank box.  How do I get it to show zero if DECTOV is not
greater than 1?  The code below will calculate 3 text boxes if DECTOV
is greater than 1.
=IIf([DECTOV1000]>1,[EMPLOYEE DATA subform].Form!TOVCOMP2)*
([PERCENTOVDEC])*([DECRATE])- Hide quoted text -
- Show quoted text -

Hi Thanks for your help, but that doesn't seem to work.  That was the
first thing I initially tried before posting on this board.  It still
shows up blank.- Hide quoted text -

- Show quoted text -

Hi Thanks. I figured it out. Rather than place the else at the end,
I reversed and placed it at the beginning like so:
=IIf([DECTOV1000]<1,0,([EMPLOYEE DATA subform].Form!TOVCOMP2)*
([PERCENTOVDEC])*([DECRATE]))
 
D

Douglas J. Steele

Is there anything set in the Format property of the text box?

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


The IIf statement actually accepts 3 parameters: the boolean condition,
what
to do if the boolean condition is True, and what to do if the boolean
condition is False. Provide 0 as the third parameter:

=IIf([DECTOV1000]>1,[EMPLOYEE DATA
subform].Form!TOVCOMP2)*([PERCENTOVDEC])*([DECRATE], 0)

--
Doug Steele, Microsoft Access MVPhttp://I.Am/DougSteele
(no e-mails, please!)




Hi I got the following to work in a text box if DECTOV (textbox) is
greater than 1. My poblem is that if DECTOV is not greater than 1 I
get a blank box. How do I get it to show zero if DECTOV is not
greater than 1? The code below will calculate 3 text boxes if DECTOV
is greater than 1.
=IIf([DECTOV1000]>1,[EMPLOYEE DATA subform].Form!TOVCOMP2)*
([PERCENTOVDEC])*([DECRATE])- Hide quoted text -

- Show quoted text -

Hi Thanks for your help, but that doesn't seem to work. That was the
first thing I initially tried before posting on this board. It still
shows up blank.
 

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