dmcgimpsey
Active Member
- Joined
- Mar 30, 2004
- Messages
- 268
Hi Folks:
I am reading a CSV file using ADODB method, and I want to code a select statement that refers to column headings containing blanks.
I tried using square braces around the field name but it did not recognize the select statement. Select * works. I get the names from the rs.Fields(x).name value
I want to code somthing like this:
Select [Field Name] from table
I just need the syntax of the select statement
Thanks in advance
Don
Here is my code:
cN.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Path & ";Extended Properties=""text;HDR=Yes;FMT=Delimited(,)"";Persist Security Info=False"
cN.ConnectionTimeout = 40
cN.Open
Set RS = New ADODB.Recordset
sQuery = "Select * From " & filename
RS.ActiveConnection = cN
RS.Source = sQuery
RS.Open
If RS.EOF <> True Then
While RS.EOF = False
Open Outfile & "\LOAD\loadfile.csv" For Append As 1
Print #1, RS.Fields(0) & "," & RS.Fields(1)
RS.MoveNext
Close #1
Wend
End If
I am reading a CSV file using ADODB method, and I want to code a select statement that refers to column headings containing blanks.
I tried using square braces around the field name but it did not recognize the select statement. Select * works. I get the names from the rs.Fields(x).name value
I want to code somthing like this:
Select [Field Name] from table
I just need the syntax of the select statement
Thanks in advance
Don
Here is my code:
cN.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Path & ";Extended Properties=""text;HDR=Yes;FMT=Delimited(,)"";Persist Security Info=False"
cN.ConnectionTimeout = 40
cN.Open
Set RS = New ADODB.Recordset
sQuery = "Select * From " & filename
RS.ActiveConnection = cN
RS.Source = sQuery
RS.Open
If RS.EOF <> True Then
While RS.EOF = False
Open Outfile & "\LOAD\loadfile.csv" For Append As 1
Print #1, RS.Fields(0) & "," & RS.Fields(1)
RS.MoveNext
Close #1
Wend
End If