I have a form that writes to a csv file, and then another form that reads from that csv file, after an input field is completed, it must search the csv files and bring back any entries that match the input field.

It works with the date field I have (see code below)and if I enter a number in another field it works, however no matter what I try it refuses to work if there is text in the input field.

SQL="SELECT * FROM [Calendar.csv] WHERE (Left([Date],10)>='"&Request.Form("DateFrom")&"' AND Left([Date],10)<='"&Request.Form("DateTo")&"') ORDER BY [Date];"

Here is the code that is giving me the problem (actually just the Channels=... section):

SQL = "SELECT * FROM Calendar.csv WHERE Channels='" & request.form("Channels")  & "'"

so how do I get it to display my results from the search using the form "Channels" field?

PS - I have included a zip file with the html, asp and csv file, if you wish to have a look

Without looking at the code I would guess that the problem is with request.form("Channels")

Try establishing its value before using it in the SQL statement like...

Dim strChannel
strChannel = request.form("Channels")

SQL = "SELECT * FROM Calendar.csv WHERE Channels='" & strChannel & "' "

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.