Help with IIF expression

Y

Yogi_Bear_79

I have a feild called EntryTime that I would like to evaluate on a form.

Pusedocode:

IIF Entry Time = 12:00:00 AM then display "-"
Else Display EntryTime

Can someone help me with some code examples
 
C

Crystal

Hi Yogi,

how about this:

IIF(nz([Entry_Time_fieldname]) = 0, "-", [Entry_Time_fieldname])

If this is a continuous form, you will want to put this in
the recordset instead of a calculated control

BUT... since Date/Time is actually stored as a number, a
better idea is to use the Format property of that actual
date/time control

format --> h:nn am/pm;h:nn am/pm;-;-

format parts:
1. positive number
2. negative number
3. zero
4. null

Have an awesome day

Warm Regards,
Crystal
 
D

Duane Hookom

Did you change the name of the text box in the report so it isn't the name
of a field?

--
Duane Hookom
MS Access MVP


Yogi_Bear_79 said:
Crystal said:
Hi Yogi,

how about this:

IIF(nz([Entry_Time_fieldname]) = 0, "-", [Entry_Time_fieldname])

If this is a continuous form, you will want to put this in the recordset
instead of a calculated control

BUT... since Date/Time is actually stored as a number, a better idea is
to use the Format property of that actual date/time control

format --> h:nn am/pm;h:nn am/pm;-;-

format parts:
1. positive number
2. negative number
3. zero
4. null

Have an awesome day

Warm Regards,
Crystal

Yogi_Bear_79 said:
I have a feild called EntryTime that I would like to evaluate on a form.

Pusedocode:

IIF Entry Time = 12:00:00 AM then display "-"
Else Display EntryTime

Can someone help me with some code examples

Crystal, thanks for the response

I entered =IIF(nz([Entry Time]) = 0, "-", [Entry Time])

which returned an error on the report. for every entry including those not
12:00:00 AM

do you have any other ideas that might help me? I'll keep tryin in the
meantime :)
 
Y

Yogi_Bear_79

Thanks,

That did it! I suppose that would be a given to most, I just dabble with
access for some basic things, I am very much a novice..

Thanks to both, it works as requested!



Duane Hookom said:
Did you change the name of the text box in the report so it isn't the name
of a field?

--
Duane Hookom
MS Access MVP


Yogi_Bear_79 said:
Crystal said:
Hi Yogi,

how about this:

IIF(nz([Entry_Time_fieldname]) = 0, "-", [Entry_Time_fieldname])

If this is a continuous form, you will want to put this in the recordset
instead of a calculated control

BUT... since Date/Time is actually stored as a number, a better idea is
to use the Format property of that actual date/time control

format --> h:nn am/pm;h:nn am/pm;-;-

format parts:
1. positive number
2. negative number
3. zero
4. null

Have an awesome day

Warm Regards,
Crystal

Yogi_Bear_79 wrote:
I have a feild called EntryTime that I would like to evaluate on a
form.

Pusedocode:

IIF Entry Time = 12:00:00 AM then display "-"
Else Display EntryTime

Can someone help me with some code examples

Crystal, thanks for the response

I entered =IIF(nz([Entry Time]) = 0, "-", [Entry Time])

which returned an error on the report. for every entry including those
not 12:00:00 AM

do you have any other ideas that might help me? I'll keep tryin in the
meantime :)
 
F

fredg

I have a feild called EntryTime that I would like to evaluate on a form.

Pusedocode:

IIF Entry Time = 12:00:00 AM then display "-"
Else Display EntryTime

Can someone help me with some code examples

I think this will clarify what you want.
In Access midnight is 00:00:00, not 12:00:00 AM.

= IIf(Format([Entry Time],"hh:nn:ss") = "00:00:00","-",(Entry Time])
 
D

Duane Hookom

This issue is not limited to just "dabblers".

--
Duane Hookom
MS Access MVP


Yogi_Bear_79 said:
Thanks,

That did it! I suppose that would be a given to most, I just dabble with
access for some basic things, I am very much a novice..

Thanks to both, it works as requested!



Duane Hookom said:
Did you change the name of the text box in the report so it isn't the
name of a field?

--
Duane Hookom
MS Access MVP


Yogi_Bear_79 said:
Hi Yogi,

how about this:

IIF(nz([Entry_Time_fieldname]) = 0, "-", [Entry_Time_fieldname])

If this is a continuous form, you will want to put this in the
recordset instead of a calculated control

BUT... since Date/Time is actually stored as a number, a better idea is
to use the Format property of that actual date/time control

format --> h:nn am/pm;h:nn am/pm;-;-

format parts:
1. positive number
2. negative number
3. zero
4. null

Have an awesome day

Warm Regards,
Crystal

Yogi_Bear_79 wrote:
I have a feild called EntryTime that I would like to evaluate on a
form.

Pusedocode:

IIF Entry Time = 12:00:00 AM then display "-"
Else Display EntryTime

Can someone help me with some code examples

Crystal, thanks for the response

I entered =IIF(nz([Entry Time]) = 0, "-", [Entry Time])

which returned an error on the report. for every entry including those
not 12:00:00 AM

do you have any other ideas that might help me? I'll keep tryin in the
meantime :)
 

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