Public Sub DoComplaintInsert(ByVal strPrefix As String, ByVal strFirstname As String, ByVal strLastname As String, ByVal strBrokerRef As String, ByVal strPolNO As String, ByVal strDateRec As DateTime, ByVal strPostDate As DateTime, ByVal strPhoneDate As DateTime, ByVal strPhoneTime As DateTime, ByVal str1stRespDate As DateTime, ByVal str2ndRespDate As DateTime, ByVal str3rdRespDate As DateTime, ByVal strResolutionDate As DateTime, ByVal str3rdPartyDate As DateTime, ByVal strClaimsOfficerDate As DateTime, ByVal str3rdWho As String, ByVal strReason As String, ByVal strOtherREason As String, ByVal strAgainst As String, ByVal strInsurer As String)
Dim strSQL As String
Dim sConn As String
Dim strTitle As String
Dim strBody As String
Dim local1 As String
Dim local2 As String
Dim local3 As String
Dim local4 As String
Dim local5 As String
Dim local6 As String
Dim local7 As String
Dim local8 As String
Dim local9 As String
Dim local1a As String
Dim local2a As String
Dim local3a As String
Dim local4a As String
Dim local5a As String
Dim local6a As String
Dim local7a As String
Dim local8a As String
Dim local9a As String
Dim oConn As SqlConnection
If strPostDate = "00:00:00" Then
local1 = ""
local1a = ""
Else
local1 = "post_date,"
local1a = "" & strPhoneDate & ","
End If
If strPhoneDate = "00:00:00" Then
local2 = ""
local2a = ""
Else
local2 = "phone_date,"
local2a = "" & strPhoneDate & ","
End If
If str1stRespDate = "00:00:00" Then
local4 = ""
local4a = ""
Else
local4 = "first_resp_date,"
local4a = "" & str1stRespDate & ","
End If
If str2ndRespDate = "00:00:00" Then
local5 = ""
local5a = ""
Else
local5 = "second_resp_date,"
local5a = "" & str2ndRespDate & ","
End If
If str3rdRespDate = "00:00:00" Then
local6 = ""
local6a = ""
Else
local6 = "third_resp_date,"
local6a = "" & str3rdRespDate & ","
End If
If strResolutionDate = "00:00:00" Then
local7 = ""
local7a = ""
Else
local7 = "resolution_date,"
local7a = "" & strResolutionDate & ","
End If
If str3rdPartyDate = "00:00:00" Then
local8 = ""
local8a = ""
Else
local8 = "third_party_date,"
local8a = "" & str3rdPartyDate & ","
End If
If strClaimsOfficerDate = "00:00:00" Then
local9 = ""
local9a = ""
Else
local9 = "claims_officer_date,"
local9a = "" & strClaimsOfficerDate & ","
End If
do the insert into the database
strSQL = "insert into complaints (prefix, first_name, last_name, broker_ref, pol_no, date_comp_rec," & local1 & "" & local2 & "" & local4 & "" & local5 & "" & local6 & "" & local7 & "" & local8 & "" & local9 & " third_who, reason, other_reason, against, insurer, date_time) values (" & strPrefix & ", " & strFirstname & ", " & strLastname & ", " & strBrokerRef & ", " & strPolNO & ", " & strDateRec & ", " & local1a & "" & local2 & "" & local4 & "" & local5 & "" & local6 & "" & local7 & "" & local8 & "" & local9 & "" & str3rdWho & " , " & strReason & ", " & strOtherREason & ", " & strAgainst & ", " & strInsurer & ", getDate())"