NilObjectExeption u

Connecting to a Sybase database via ODBC.
Trying to pull dates for some simple date math so i first need to test for Nil value in the date field I am pulling in.
I test for a Nil date prior to assignment of the field value to a variable like this:

If rslines.Field(“OriginalShipDate”) <> Nil then
UseDate = rslines.Field(“OrigialShipDate”)
end if

No matter how i code this, and I have tried various methods, i still get “Converting a Nil Date to DateTime is not supported” or “NilObjectException”

Any help would be greatly appreciated.

You’re not testing for your field value to be nil but for the field inside your recordset.
For API 1 which you seem to be using, try

If rslines.Field(“OriginalShipDate”).Value <> Nil then
   UseDate = rslines.Field(“OrigialShipDate”).DateValue
end if

Welcome.

In addition, you have a typo on the second line, “Origial…”. Is that in the original code?

Also, please use the code tags to make it easier for us. You can do that easily by using three backticks ("`") before and after the code block.

Thanks for the insight. The typo was there because I was bringing back an earlier effort and did not check my typing. I will use the backticks in the future.

Just highlight the code block with the mouse, and then click the </> button.