INSERTING A NULL VALUE DTPICKER TO MS ACCESS DB WITH A DATE/TIME FIELD TYPE

Submitted by shaolin on

hi every one here.

i hope some expert here in vb6.0 could help me on my problem handling null values of dtpicker.

i'm bothering about this error how to solve this. this is my code:

         sql = "INSERT INTO NOSOld ("

         sql = sql & "ID, "

         sql = sql & "Name, "

         sql = sql & "Specialization, "

         sql = sql & "Date_of_NOS, "

         sql = sql & "Date_Encoded, "

         sql = sql & "Case_Officer, "

         sql = sql & "Notes, "

         sql = sql & "Status"

         sql = sql & ")"

         sql = sql & "VALUES "

         sql = sql & "("

         sql = sql & "'" & lngID & "', "

         sql = sql & "'" & Text2.Text & "', "

         sql = sql & "'" & Text3.Text & "', "

         If DTPicker2.CheckBox = True Then

            sql = sql & "'" & CDate(DTPicker2.Value) & "', "

         Else

            sql = sql & Null & ", "

         End If

         If DTPicker1.CheckBox = True Then

            sql = sql & "'" & CDate(DTPicker1.Value) & "', "

         Else

            sql = sql & Null & ", "

         End If

         sql = sql & "'" & Combo1.Text & "', "

         sql = sql & "'" & Text4.Text & "', "

         sql = sql & "'" & Combo2.Text & "' "

         sql = sql & ")"

         cn.Execute (sql)

when i hit enter the error message pop upping saying "INVALID USE OF NULL". i've tried other suggestions but didn't lucky and still getting the same error. 

 

please need some help.

 

thanks in advance,