Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Spaces in " select from file" query

Status
Not open for further replies.

fortres2

Programmer
Nov 27, 2008
1
Hi All,
I've got recordset which selects data from text file:

dim rs1 as new ADODB.Recordset
dim strSaveFilename as string

strSaveFileName = "C:\Program Files\Example folder\test.txt"
rs1.Open "SELECT * from [" & strSaveFilename & "] ;", _
connTXT, adOpenStatic, adLockReadOnly, adCmdText

but it works only if there are no spaces in strSaveFileName path. (it will fail in this example)

Please advise
 
What is connTXT? Why is this not:

Code:
connTXT = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Program Files\Example folder;Extended Properties=""text;HDR=Yes;FMT=Delimited"";"

rs1.Open "SELECT * from [Table1.txt] ;", _
        connTXT, adOpenStatic, adLockReadOnly, adCmdText
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top