But your SQL is kind of silly.
You are asking to find notes that are not equal to a SINGLE SPACE:
- Code:
-
....
" where Q" & vCount & "notes <> " & "' '" & " ...
...
If you want to only find notes that are non blank, the LOOK for non-blanks!
- Code:
-
...
fld = "Q" & vCount & "notes"
sqlGetNotes = "select " & field & " as Notes from " & rsSections("tableid") _
& " where " & fld & " <> '' and AuditID = '" & AuditID & "'"
...
Finally, I think you are making a mistake using a loop and getting one record each time.
I think you should simply get all the fields and then loop inside the record:
- Code:
-
sqlGetNotes = "select * FROM " & rsSections("tableid") & " WHERE AuditID = '" & AuditID & "'"
Set rsGetNotes = PADBConn.Execute(sqlGetNotes)
If rsGetNotes.EOF Then
Response.Write "No record for AuditID " & AuditID & "<hr>"
Else
For vnum = vCount To 1 Step -1
notes = Trim( rsGetNotes( "Q" & vnum & "notes" ) )
If notes <> "" Then
Response.Write vnum & ": " & notes & "<br>"
End If
Next
End If
rsGetNotes.Close
...