NewbiDoobie
Technical User
I am trying to read information from an excel spreadsheet to place them into a database.
Problemn I am having is that I cannot seem to read a comma delimted Cell. I only want to import it as a text field, but every time i walk through that cell it puts it in as a blank.
Why is this such a huge issue if I only want to read it as a string value? Why Cannot I read this cell with VB, SQL Server or Access? None of these are working.
ID OldValue NewValue
1 123,old 123, 124, 125
2 All 195 Codes P195, C195, D195
Problemn I am having is that I cannot seem to read a comma delimted Cell. I only want to import it as a text field, but every time i walk through that cell it puts it in as a blank.
Why is this such a huge issue if I only want to read it as a string value? Why Cannot I read this cell with VB, SQL Server or Access? None of these are working.
ID OldValue NewValue
1 123,old 123, 124, 125
2 All 195 Codes P195, C195, D195
Code:
Dim Coder As String
Dim ROKey1 As Integer
Dim CONN As ADODB.Connection
Dim RS As ADODB.Recordset
Dim SQL As String
Set CONN = New ADODB.Connection
Set RS = New ADODB.Recordset
CONN.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=C:\DEVDatabases\RTDiagCodes2.xls;" & _
"Extended Properties=""Excel 8.0;HDR=Yes"""
With RS
.Open "SELECT * FROM [Sheet1$]", CONN, adOpenDynamic, adLockOptimistic
.MoveFirst
End With
Do Until RS.EOF
ROKey.Text = RS.Fields(0)
ROKey1 = RS.Fields(0)
Coder = CStr(RS.Fields(2))
'ROKey1 = 1
'Coder = "test"
SQL = " insert into HACodeListXref Values( '" & ROKey1 & "','" & Coder & "')"
NewCode.Text = SQL
'Codeer = CStr(RS.Fields(0)) + " " + CStr(RS.Fields(2))
DbConnect.Execute (SQL)
RS.MoveNext
Loop
MsgBox "Done"