Updating Teradata from Excel. Problem updating date field to NULL

Database
N/A

Updating Teradata from Excel. Problem updating date field to NULL

Hello!

I have created an application in MS Excel that downloads records from Teradata, allows the user to edit, and then upload edited records back to Teradata. My problem is related to Date fields in my Excel form: if the value of the field is Empty or Null then i want to upload a NULL value to the coresponding Teradata Date field, but i contine to get the following error message: "

A character string failed conversion to a numeric value."

 STR_STRING = " Update " & TBLNAME & " set STATUS = '" & STATUSX
        STR_STRING = STR_STRING & "',Doc_Type ='" & Doc_Typex
        STR_STRING = STR_STRING & "',Doc_ID ='" & Doc_IDx
        STR_STRING = STR_STRING & "',Date_Worked ='" & Date_Workedx
        STR_STRING = STR_STRING & "',Date_Recvd ='" & Date_Recvdx
1 REPLY
N/A

Re: Updating Teradata from Excel. Problem updating date field to NULL

Hello!

I have created an application in MS Excel that downloads records from Teradata, allows the user to edit, and then upload edited records back to Teradata. My problem is related to Date fields in my Excel form: if the value of the field is Empty or Null then i want to upload a NULL value to the coresponding Teradata Date field, but i contine to get the following error message: "

A character string failed conversion to a numeric value."

        If (Me.TextBox3 = vbNullString) Then
            Date_Workedx = vbNullString
            Else
            Date_Workedx = Format(Me.TextBox3, "yyyy-mm-dd")
        End If
        If (Me.TextBox23 = vbNullString) Then
            Date_Recvdx = vbNullString
            Else
            Date_Recvdx = Format(Me.TextBox23, "yyyy-mm-dd")
        End If
        If (Me.Date_Ltr_Sent = vbNullString) Then
            Date_ltr_Sentx = vbNullString
            Else
            Date_ltr_Sentx = Format(Me.Date_Ltr_Sent, "yyyy-mm-dd")
        End If
       
SRNX = Me.ComboBox1A
Doc_IDx = Me.TextBox2
Doc_Typex = Me.TextBox9
Statex = Me.TextBox10

        STR_STRING = " Update " & TBLNAME & " set STATUS = '" & STATUSX
        STR_STRING = STR_STRING & "',Doc_Type ='" & Doc_Typex
        STR_STRING = STR_STRING & "',Doc_ID ='" & Doc_IDx
        STR_STRING = STR_STRING & "',Date_Worked ='" & Date_Workedx
        STR_STRING = STR_STRING & "',Date_Recvd ='" & Date_Recvdx
        STR_STRING = STR_STRING & "',Date_ltr_Sent ='" & Date_ltr_Sentx
        STR_STRING = STR_STRING & "',State ='" & Statex
        STR_STRING = STR_STRING & "' WHERE SRN = '" & SRNX & "';"

        cmdSQLData.CommandText = STR_STRING
        cmdSQLData.CommandType = adCmdText
        cmdSQLData.CommandTimeout = 2800
        Set recset = cmdSQLData.Execute()