How is "last_serviced" being used? Is it being added into the SQL? For example, if you have this right now:
Code:
SQL = "INSERT INTO MyTable (MyDate) VALUES ('" & last_serviced & "')"
then the final SQL sent to the database, when last_serviced isn't a valid date, is going to look like this:
Code:
INSERT INTO MyTable (MyDate) VALUES ('')
because you're using a literal null, not the string NULL. And because you'd have (in this example) single-quotes around it every time, you can't just send it a string called "NULL".
If instead your code looked like this:
Code:
if isdate(last_serviced) then
last_serviced = "'" & last_serviced & "'"
else
last_serviced = "NULL"
end if
and you used SQL concatenation like this:
Code:
SQL = "INSERT INTO MyTable (MyDate) VALUES (" & last_serviced & ")"
(note the lack of single quotes), then if last_serviced is an actual date, the SQL would look like this:
Code:
INSERT INTO MyTable (MyDate) VALUES ('12/18/2004')
and if it's not a valid date, then the SQL would look like this:
Code:
INSERT INTO MyTable (MyDate) VALUES (NULL)
which is what you actually need. Not a VBScript Null (which is nothing), but the letters N U L L without any single quotes around them. Make sense?