ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Problem with query against CSV file using ADO (https://www.excelbanter.com/excel-programming/406670-problem-query-against-csv-file-using-ado.html)

todtown

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


All times are GMT +1. The time now is 01:33 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com