Hi all:
What I'm looking for is how to write a WHERE clause for an ADO Connection that is from a CSV file. I've included my code thus far.
Set Con = New ADODB.Connection
Set RS = New ADODB.Recordset
Con.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=Y:\DebtNegotiationsCSV\;Extended Properties=""text;HDR=No;FMT=Delimited"""
Con.Open Con.ConnectionString
Sql = "Select * from " & Station & ".csv"
On Error GoTo WrongStation
Retry:
RS.Open Sql, Con, adOpenDynamic, adLockBatchOptimistic
Do While Not RS.EOF
ZIP = RS(0).Value
If Len(ZIP) = 3 Then ZIP = "00" & ZIP
If Len(ZIP) = 4 Then ZIP = "0" & ZIP
City = RS(1).Value
County = RS(2).Value
State = RS(3).Value
If S = True Then
InsertSQL
ElseIf A = True Then
AddToAccess
Else
AddToAccess
InsertSQL
End If
Rec = Rec + 1
lblRec.Caption = Format(Rec, "##,###") & " Records Added"
DoEvents
RS.MoveNext
Loop
RS.Close
Con.Close
Thanks,
Ron
Ron Repp
What I'm looking for is how to write a WHERE clause for an ADO Connection that is from a CSV file. I've included my code thus far.
Set Con = New ADODB.Connection
Set RS = New ADODB.Recordset
Con.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=Y:\DebtNegotiationsCSV\;Extended Properties=""text;HDR=No;FMT=Delimited"""
Con.Open Con.ConnectionString
Sql = "Select * from " & Station & ".csv"
On Error GoTo WrongStation
Retry:
RS.Open Sql, Con, adOpenDynamic, adLockBatchOptimistic
Do While Not RS.EOF
ZIP = RS(0).Value
If Len(ZIP) = 3 Then ZIP = "00" & ZIP
If Len(ZIP) = 4 Then ZIP = "0" & ZIP
City = RS(1).Value
County = RS(2).Value
State = RS(3).Value
If S = True Then
InsertSQL
ElseIf A = True Then
AddToAccess
Else
AddToAccess
InsertSQL
End If
Rec = Rec + 1
lblRec.Caption = Format(Rec, "##,###") & " Records Added"
DoEvents
RS.MoveNext
Loop
RS.Close
Con.Close
Thanks,
Ron
Ron Repp