By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,247 Members | 1,057 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,247 IT Pros & Developers. It's quick & easy.

intermittent type mismatch

P: n/a
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
Jul 21 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
What line does the type mismatch occur.

Jeff
"LJgrnl" <LJ****@discussions.microsoft.com> wrote in message
news:B7**********************************@microsof t.com...
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

Jul 21 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.