L
LJgrnl
I've got a type mismatch error that's driving me nutty. Variable blnNoData
has the initial value False. If a recordset comes back empty (both .EOF and
..BOF are true) then blnNoData is set to True. I then have an if statement to
determine what to write to the screen depending on blnNoData. As long as the
if statement is true (doesn't have to go to the else clause), the code runs
fine. Otherwise, a type mismatch error is returned. In other words, if the
recordset is empty and I test "If blnNoData", then it's fine, but if the
recordset is not empty, the type mismatch error happens. If the recordset is
not empty and I test "If not blnNoData", then it's fine, but if the
recordset is empty the type mismatch error happens.
Code below:
dim sqlEMI, aryEMI, blnNoData
blnNoData = False
sqlEMI = "select emiNumber, emiTitle, savingsElectricity,
costSavingsElectricity, savingsDemand, costSavingsDemand, " &_
"nonEnergySavings, rebateorGrantAmount, netCostSavings, annualCostSavings,
simplePayback, recommended " & _
"from bem_trelDescriptionToEMI de " & _
"inner join bem_tblEMI e on de.emiid = e.emiid " &_
"inner join bem_tlkEMICodes ec on e.emitypeid =
ec.emitypeid " &_
"inner join bem_tlkBuildingSystem bs on bs.systemid =
de.systemid " &_
"where de.teaid = " & session("intTeaID")
getConn()
getRS(sqlEMI)
if adoRS.EOF and adoRS.BOF then
blnNoData = True
else
aryEMI = adoRS.GetRows
end if
closeRS()
closeConn()
'#######################################################
'TABLE HEADER
'#######################################################
response.write "<div class='smalllandscapereport'><div class=header><p>List
of EMI Savings & Cost</p></div>" & vbcrlf
'response.end
if blnNoData then
response.write "<p>Unable to retrieve EMI information. This may be
because you haven't entered any information for this form yet. Please review
form input and try again.</p>"
else
'....(display recordset results)
end if
has the initial value False. If a recordset comes back empty (both .EOF and
..BOF are true) then blnNoData is set to True. I then have an if statement to
determine what to write to the screen depending on blnNoData. As long as the
if statement is true (doesn't have to go to the else clause), the code runs
fine. Otherwise, a type mismatch error is returned. In other words, if the
recordset is empty and I test "If blnNoData", then it's fine, but if the
recordset is not empty, the type mismatch error happens. If the recordset is
not empty and I test "If not blnNoData", then it's fine, but if the
recordset is empty the type mismatch error happens.
Code below:
dim sqlEMI, aryEMI, blnNoData
blnNoData = False
sqlEMI = "select emiNumber, emiTitle, savingsElectricity,
costSavingsElectricity, savingsDemand, costSavingsDemand, " &_
"nonEnergySavings, rebateorGrantAmount, netCostSavings, annualCostSavings,
simplePayback, recommended " & _
"from bem_trelDescriptionToEMI de " & _
"inner join bem_tblEMI e on de.emiid = e.emiid " &_
"inner join bem_tlkEMICodes ec on e.emitypeid =
ec.emitypeid " &_
"inner join bem_tlkBuildingSystem bs on bs.systemid =
de.systemid " &_
"where de.teaid = " & session("intTeaID")
getConn()
getRS(sqlEMI)
if adoRS.EOF and adoRS.BOF then
blnNoData = True
else
aryEMI = adoRS.GetRows
end if
closeRS()
closeConn()
'#######################################################
'TABLE HEADER
'#######################################################
response.write "<div class='smalllandscapereport'><div class=header><p>List
of EMI Savings & Cost</p></div>" & vbcrlf
'response.end
if blnNoData then
response.write "<p>Unable to retrieve EMI information. This may be
because you haven't entered any information for this form yet. Please review
form input and try again.</p>"
else
'....(display recordset results)
end if