Re: Error message - Can someone check my code?

Tech-Archive recommends: Fix windows errors by optimizing your registry



"Sheldon" <Sheldon@xxxxxxxxxxxxxxxxxxxxxxxxx> schrieb:
The following code is returning the error "Invalid cast exception.
Conversion from type DBNull to type Date is not valid." It will return the
recordset if DateWritten has a date in it, but if it does not, I get the
error. Any help will be appreciated1

<snip>
If dsEmailSearch.Tables("tblEmailAdd").Rows(currentEmailRow)("DateWritten")
Is Nothing = True Then

=> 'If ... Is DBNull.Value Then' or 'If IsDBNull(...) Then'.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

.