I'm working on a query in the Access 2019 query editor that pulls from a table with a text field containing both text and dates, none of which are uniform in any way. For instance a date could look like 02-15-22 or 2/15/2022, and various strings that are not dates. Using the CDate or DateValue functions return #Error when the field doesn't contain something of a valid date format, so I thought that I'd check for the error:
iif(iserror(cdate([field1])),"",cdate([field1]))
However the #Error still comes up. I've tried checking for Nulls, trying to see if the field IsNumeric, etc., but I don't understand why that error check isn't doing the job. Greatly appreciate any input! Here's the SQL View if it helps at all:
SELECT dbo_Stock.stk_item_no, dbo_SalesItems.s_descript, dbo_Stock.stk_inv_qttytd, dbo_Stock.stk_row, dbo_Stock.stk_aisle, dbo_Stock.stk_bin, IIf(IsError(CDate([stk_bin])),"",CDate([stk_bin])) AS bin
FROM dbo_SalesItems INNER JOIN dbo_Stock ON dbo_SalesItems.[s_item_no] = dbo_Stock.[stk_item_no];
Result of Datasheet View:
Thank you,
- Xevon -
iif(iserror(cdate([field1])),"",cdate([field1]))
However the #Error still comes up. I've tried checking for Nulls, trying to see if the field IsNumeric, etc., but I don't understand why that error check isn't doing the job. Greatly appreciate any input! Here's the SQL View if it helps at all:
SELECT dbo_Stock.stk_item_no, dbo_SalesItems.s_descript, dbo_Stock.stk_inv_qttytd, dbo_Stock.stk_row, dbo_Stock.stk_aisle, dbo_Stock.stk_bin, IIf(IsError(CDate([stk_bin])),"",CDate([stk_bin])) AS bin
FROM dbo_SalesItems INNER JOIN dbo_Stock ON dbo_SalesItems.[s_item_no] = dbo_Stock.[stk_item_no];
Result of Datasheet View:
Thank you,
- Xevon -