Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Null value for date/time field as "Off"

Status
Not open for further replies.

esu4edp

Technical User
Feb 15, 2000
59
US
I have a report that has a time field. If that value is not filled in or left blank, I want that value to be displayed at "Off" on the report. I have tried several statements but they dont work:

Nz([Arrive],"Off")

SELECT IIF(IsNull([Arrive]), 'OFF, [Arrive])

=IIF([Arrive] Is Null,OFF,[Arrive])

none of these have worked or have given errors.
 
Did you try entering the following into the format property of the control on the report in stead?

[tt]hh:nn:ss;;"Off";"Off"[/tt]

Roy-Vidar
 
If this is a control source then you have to set the equal sign. Also the "OFF" must be in quotes. Lastly if the textbox name is Arrive then you can't have a field with the same name, you might change it to fldArrive.

=IIF([Arrive] Is Null,"OFF",[Arrive])
 
hh:nn:ss;;"Off";"Off"

This worked out great exept for times that started at midnight or 00:00

the other example =IIF([Arrive] Is Null,"OFF",[Arrive])

keeps giving me an error
 
how about trying

= IIf(IsNull([Arrive]),"OFF",[Arrive])

or

=IIf(nz([Arrive],"")="","OFF",[Arrive])


HTH


John





When Galileo theorized that Aristotle's view of the Universe contained errors, he was labeled a fool.
It wasn't until he proved it that he was called dangerous.
[wink]
 
hh:nn:ss;;;"Off"

This worked perfect!

Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top