Hi there,
Part of the script like this below. The values in some columns are varchar. But this script works fine until it meets a name like this KK K'mm.
How can I modify the script to avoid this problem?
====================================
Sub Test1()
Dim SQL As String
Dim X As Integer
-------------------------
C.Execute "Truncate Table Agent_list"
For X = 2 To 142
SQL = "Insert Into Agent_list Values ( '" & Cells(X, 1) & "', "
If Cells(X, 2) = "" Then
SQL = SQL & "Null, "
Else
SQL = SQL & "'" & Cells(X, 2) & "', "
End If
---------------------------
C.Execute SQL
Next X
============================
many thanks,
Jana
Part of the script like this below. The values in some columns are varchar. But this script works fine until it meets a name like this KK K'mm.
How can I modify the script to avoid this problem?
====================================
Sub Test1()
Dim SQL As String
Dim X As Integer
-------------------------
C.Execute "Truncate Table Agent_list"
For X = 2 To 142
SQL = "Insert Into Agent_list Values ( '" & Cells(X, 1) & "', "
If Cells(X, 2) = "" Then
SQL = SQL & "Null, "
Else
SQL = SQL & "'" & Cells(X, 2) & "', "
End If
---------------------------
C.Execute SQL
Next X
============================
many thanks,
Jana