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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Date Is "" If statement (Easy one I think)

Status
Not open for further replies.

Jefftopia

Programmer
Jul 30, 2002
104
0
0
US
All I need is a simple date formula that shows the date if a date exists in the table/field. If a date has not been entered in the table/field, I would like it to show as "N/A".

Here is the formula I have tried:

if {tblPrimDls.PDLine} = "" then "N/A" else {tblPrimDls.PDLine}

tblPrimDls.PDLine is a Date/Time field in MSAccess Database.

Error I am getting:

A date is required here. Focus is then given to ""
 
Try:

if isnull({tblPrimDls.PDLine})
or
{tblPrimDls.PDLine} < currentdate - 10000 then
&quot;N/A&quot;
else
totext({tblPrimDls.PDLine})

There are other ways to handle this, and the second check is a sanity check which states that the date must be greater than 10000 days ago (about 27 years, adjust as required).

Not knowing what the default is for this row or whether null is allowed, I'd just use something like that.

-k kai@informeddatadecisions.com
 
if IsNull({tblPrimDls.PDLine}) then &quot;NA&quot;
else TOText({tblPrimDls.PDLine})

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top