Query returning No Records
Hi,
I have a query that is returning no records. Here is the qiery. I am using ASP and qiering against an Access database.
<%
If (request.form("agency")) = "" Then
stragency = "Like '*'"
Else
stragency = request.form("agency")
stragency = "='" & request.form("agency") & "'"
End If
If (request.form("decision")) = "" Then
strdecision = "Like '*'"
Else
strdecision = "='" & request.form("decision") & "'"
End If
If (request.form("ranking")) = "" Then
strranking = "Like '*'"
Else
strranking = "='" & request.form("ranking") & "'"
End If
If (request.form("interviewed")) = "" Then
strinterviewed_by = "Like '*'"
Else
strinterviewed_by = "='" & request.form("interviewed") & "'"
End If
strfrom_date = "#" & request.form("from_date") & "#"
strto_date = "#" & request.form("to_date") & "#"
'This checks to see if only to date has a value in it
if not(request.form("to_date")) = "" and request.form("from_date") = "" then
strfrom_date = "#" & request.form("to_date") & "#"
strsql3 = "SELECT TBLfinal_table.[Candidate Name], TBLfinal_table.[Todays Date], TBLfinal_table.[agency], TBLfinal_table.[Interviewed By], TBLfinal_table.[Ranking], TBLfinal_table.[Decision] " & _
"FROM TBLfinal_table " & _
" WHERE TBLfinal_table.Agency " & stragency & _
" AND TBLfinal_table.[Interviewed By] " & strinterviewed_by & _
" AND TBLfinal_table.[Ranking] " & strranking & _
" AND TBLfinal_table.[Decision] " & strdecision & _
" AND TBLfinal_table.[Todays Date] " & _
" BETWEEN " & strfrom_date & " AND " & strto_date & _
" ORDER BY TBLfinal_table.[Candidate Name];"
response.write " test " & strsql3
rs.Open strsql3, conn
rs.movefirst
end if
When I response.write this out everything apears to be written properly but when I try to use this qiery no records are returned. I know this because when I try to move to the first record I get the following error,
Error Type:
ADODB.Recordset (0x800A0BCD)
Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record.
/qieries.asp, line 122
Thank you very much for your help in advance
|