View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
todtown todtown is offline
external usenet poster
 
Posts: 35
Default Problem with query against CSV file using ADO

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