Problem with query against CSV file using ADO

T

todtown

I'm using ADO withing Excel to connect to a CSV file.

My connection works:
'Where fpath is the folder where the csv file resides
cn.Open _
"Driver={Microsoft Text Driver (*.txt; *.csv)};" & _
"Dbq=" & fpath & ";" & _
"Extensions=asc,csv,tab,txt"

This query works:

sql = "SELECT COUNT(F9) FROM filename.csv"

But when I add a WHERE clause:

sql = "SELECT COUNT(F9) FROM filename.csv WHERE F7 = 390"

I get the error "Too few parameters. Expected 1."

What can I do different to make this work?

tod
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top