vb.net: insert a truly null date in access db
August 16, 2007
If you’ve had trouble trying to force an actual, truly blank/null value in a date field in an Access database, you probably aren’t alone.
The task of assigning a true null value, in this case, via the key word “Nothing”, requires the use of the Nullable(Of Date) type.
Google Nullable(of date) and .HasValue.
You’ll need both of those bits to make the whole thing work.

May 29, 2008 at 10:40 am
how can i insert null value in date column in vb.net?
July 13, 2008 at 2:15 pm
yes. look up nullable(of date) and .hasValue.
it’s a little tricky to tie it all together, but you can make it work.
July 17, 2008 at 7:42 pm
Any other “Hints”?????
I’m trying to condiinally “undo” a date if a parameter changes by:
IIf([PMPPOU] And [PCPOU] And [PSSU] And [PAU] And [DPIRC] And [DMPU] And [DCPU] And [DBU] And [SSU] And [ERMPOC] And [PBN]=True,Date(), Null)
If on eof the checkboxes changes to be not true than I want the Date field to go back to Null.
I can’t get it to work.
July 27, 2008 at 1:06 pm
vbnotebookfor.net has exactly what you need.
he shows getting from a database, but not setting values to a database.
here’s one way:
If theDate.HasValue Then
cmd.Parameters.Add(New OleDb.OleDbParameter(“@theDate”, theDate))
Else
cmd.Parameters.Add(New OleDb.OleDbParameter(“@theDate”, DBNull.Value))
End If