I am trying to build a dynamic SQL query in asp using a "for loop".
I can get the "for loop" results to display fine in browser using "response.write"
I want to put the "for loop" results into an SQL query
Here is the code which genrates syntax errors:
Recordset2.Source = "SELECT * FROM Products WHERE " & _
For fnum2 = 4 To Recordset1.Fields.Count-1
If Recordset1.Fields(fnum2).Value = 1 then
Product_Code = '" & _Recordset1.Fields(fnum2).Name & "' AND"