A family of Microsoft relational database management systems designed for ease of use.
Try this --
=IIF(IsDate([compdatetime]), DateValue(compdatetime),"")
Or --
=IIF(IsDate([compdatetime]), DateValue(compdatetime), Null)
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Hello,
I have a date/time field called "compdatetime" in my database. There are blank record in the compdate field.
I am trying to convert the date/time stamp field to just date only which I use compdate=DateValue(compdatetime).
I worked only the records with value. Any record without value is returns #ERROR.
How I can fixed this problem so instead of return #ERROR, return blank/ empty? I tried IIF statement, but it didn't work.
=IIF(compdatetime is not null, DateValue(compdatetime),"")
This does return blank on record without value, except it return the date as text field. THANKS
A family of Microsoft relational database management systems designed for ease of use.
Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.
Answer accepted by question author
Try this --
=IIF(IsDate([compdatetime]), DateValue(compdatetime),"")
Or --
=IIF(IsDate([compdatetime]), DateValue(compdatetime), Null)
=IIF(compdatetime is not null, DateValue(compdatetime),"")
Try incorporating the ISNULL() function in the criteria of your IIF() function.
SELECT IIF(ISNULL(dt.compdatetime),"", DATEVALUE(dt.compdatetime)) As [Just the Date]
FROM tblDateTime AS dt;
Thank Karl,
The second option worked. The first didn't.