How to handle "#Error" values in a query column.
Posted on 2007-09-28
I've got a SELECT query with one column that uses the function
DATEADD("d", RetrainingPeriod, LastTimeTrained) AS NextTimeToTrain
and a WHERE clause that says
WHERE NextTimeToTrain <= Date() OR LastTimeTrained IS NULL
The goal being a list of all the people who either have not been trained at all, or who are past due for re-training.
The problem is that LastTimeTrained can be NULL if they've never taken the course, and that makes NextTimeToTrain have "#Error" values, and whenever I try and do anything to that column I'm getting type mismatch errors. Does anybody know a way to avoid this, or to "clean" out the errors (make them NULL)?