intermittent type mismatch

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
 
J

Jeff Dillon

What line does the type mismatch occur.

Jeff
LJgrnl said:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,822
Latest member
israfaceZa

Latest Threads

Top