Using IsError and IIf (1 Viewer)

aziz rasul

Registered User.
Local time
Today, 21:41
Joined
Jun 26, 2000
Messages
1,743
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

Registered User.
Local time
Today, 21:41
Joined
Jun 26, 2000
Messages
1,743
[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, 21:41
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

Registered User.
Local time
Today, 21:41
Joined
Jun 26, 2000
Messages
1,743
Thanks Brian. That worked. Should have thought of that.
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Top Bottom