Using IsError and IIf (1 Viewer)

aziz rasul

Active member
Local time
Today, 14:10
Joined
Jun 26, 2000
Messages
1,935
I am querying a date field which in some few cases do not have dates and hence I'm getting #Error.

I am trying to use a combination of the IIf and the IsError functions in order to produce a null or "" value instead of #Error. Here's what I am trying in a select query but I still get the same result?

STARTDATE: IIf(IsError(CDate([DFIT])),"",CDate([DFIT]))
 

aziz rasul

Active member
Local time
Today, 14:10
Joined
Jun 26, 2000
Messages
1,935
[DFIT] is numerical and hence I have to use CDate. Taking your suggestion in using IsDate, I tried the following: -

IIf(IsDate(CDate([DFIT])),CDate([DFIT]),"")

and got the same problem as before with #Error appearing.
 

Brianwarnock

Retired
Local time
Today, 14:10
Joined
Jun 2, 2003
Messages
12,701
Sorry thought you were just checking a date field, try IsNumeric , I think IsNull might work also.

IIf(IsNumeric(DFIT),Cdate([DFIT]),"")

Brian
 

aziz rasul

Active member
Local time
Today, 14:10
Joined
Jun 26, 2000
Messages
1,935
Thanks Brian. That worked. Should have thought of that.
 

Users who are viewing this thread

Top Bottom