I have an Access 97 database with some null values in date/time fields. I have databound my date time picker controls to a recordset, and set the datafield to the date/time field in my table.
When I pull the record, the dtpicker has no problem with bringing in a null. The problem is when I have to append back to the table. I have to put the DTPicker's value in quotes (ie send it down to the db as a string) in order not to get a syntax error in my sql statement in VB. Access does an implicit conversion on the data, and all works well, but I'm just wondering if anyone else has had this problem?
Connopen and RSopen are general Connection and Recordset procedures.
Dim sql As String
sql = "select * from ser where ser_number = '" & Trim(Text1(0).Text) & "'"
ConnOpen
RSOpen (sql)
If rsSER.EOF Then
sql = "insert into ser (bus_design_rcvd_date, assigned_date, priority) values " & _
"('" & DTPicker1.Value & "', '" & DTPicker2.Value & "','" & Trim(txtPriority.Text) & "')"
When I pull the record, the dtpicker has no problem with bringing in a null. The problem is when I have to append back to the table. I have to put the DTPicker's value in quotes (ie send it down to the db as a string) in order not to get a syntax error in my sql statement in VB. Access does an implicit conversion on the data, and all works well, but I'm just wondering if anyone else has had this problem?
Connopen and RSopen are general Connection and Recordset procedures.
Dim sql As String
sql = "select * from ser where ser_number = '" & Trim(Text1(0).Text) & "'"
ConnOpen
RSOpen (sql)
If rsSER.EOF Then
sql = "insert into ser (bus_design_rcvd_date, assigned_date, priority) values " & _
"('" & DTPicker1.Value & "', '" & DTPicker2.Value & "','" & Trim(txtPriority.Text) & "')"