J
Jack
I am trying to debug a if else statement by using the following lines of code
Response.Write RSreccountCurrentExpense("reccount") & "<br>"
If RSreccountCurrentExpense("reccount") < 1 Then
Response.Write "Good"
Response.End
For a particular record,I can see that the if staement condition is satisfed
and hence the if statement should be executed.
However, if I comment out Response.End statment to let the whole code
execute I am getting
the error message as shown below. The error message shows that the else
statment is
getting executed and not the if. Once the if statement condition is
satisfied, only the
if statement should be executed and not the else. Cannot figure out why this
is happening.
Any insight to the problem is highly appreciated. Thanks in advance. Regards
ERROR MESSAGE:
Either BOF or EOF is True, or the current record has been deleted. Requested
operation requires a current record.
/gwisbrandnewready6/mainreportagain1.asp, line 745
CODE:
RSreccountCurrentExpense.Open "select COUNT(*) AS reccount from
tblGMISExpenditures_Quarter where SubgrantIntID = " & GrantID & ";"
Response.Write RSreccountCurrentExpense("reccount") & "<br>"
If RSreccountCurrentExpense("reccount") < 1 Then
' Response.Write "Good"
' Response.End
l_cu_CurrentOutlay = 0
l_cu_LocalShareOfOutlay = 0
l_cu_UnpaidObligations = 0
l_cu_LocalShareUnpaidObligations = 0
l_cu_OtherProjectIncomeReceived = 0
l_cu_ForfeitureIncomeReceived = 0
l_cu_OtherProjectIncomeExpenditures = 0
l_cu_ForfeitureIncomeExpenditures = 0
l_cu_InterestIncomeReceivedOnMBCCFunds = 0
l_Remarks = ""
l_Name = ""
l_PersonsTitle = ""
l_PhoneAreaCode = ""
l_Phone1 = ""
l_Phone2 = ""
l_Date = formatdatetime(date,2)
l_IsChecked = "off"
'Note here we need to handle the local variable
Session("l_cu_c_MBCCShareOfOutlays")
'which gets saved in the database on a save command issue.
Session("l_cu_c_MBCCShareOfOutlays") = 0
Else
l_cu_CurrentOutlay = RSCurrentExpense.Fields("CurrentOutlay")
l_c_TotalNetOutlaysToDate = (l_p_TotalOutlay + l_cu_CurrentOutlay)
l_cu_LocalShareOfOutlay = RSCurrentExpense.Fields("LocalShare")
l_cu_c_MBCCShareOfOutlays = (l_cu_CurrentOutlay - l_cu_LocalShareOfOutlay)
'We declare a session variable in order to use this variabel in the
insertorupdatecurrentexpense.asp
Session("l_cu_c_MBCCShareOfOutlays") = l_cu_c_MBCCShareOfOutlays
l_cu_UnpaidObligations = RSCurrentExpense.Fields("UnpaidOblig")
l_cu_LocalShareUnpaidObligations =
RSCurrentExpense.Fields("LocalShareUnpaidOblig")
l_cu_MBCCShareUnpaidObligations = (l_cu_UnpaidObligations -
l_cu_LocalShareUnpaidObligations)
l_cu_c_UnobligatedBalanceMBCCFunds = (l_TotalMBCCFundsAuth -
l_p_c_MBCCShareOutlays - l_cu_c_MBCCShareOfOutlays -
l_cu_MBCCShareUnpaidObligations)
'Note: The following field has already been defined earlier and has been
' assigned a value. Hence, we do not change anything with this field
'except for plugging the value in the right place
'l_TotalLocalMatchAuth
'-------------------------------------------------------------------------------------------------------
l_cu_c_UnobligatedBalanceLocalMatch = (l_TotalLocalMatchAuth -
l_p_LocalShareOfOutlays - l_cu_LocalShareOfOutlay -
l_cu_LocalShareUnpaidObligations)
'------------------------------------------------------------------------------------------------------
'Note: The following field has already been defined earlier and has been
'assigned a value. Hence, we do not change anything with this field
'except for plugging the value in the right place
'l_p_TotalCashDispursed
'-------------------------------------------------------------------------------------------------------
l_cu_c_MBCCCashOnHand = (l_p_TotalCashDispursed -
l_p_c_MBCCShareOutlays - l_cu_c_MBCCShareOfOutlays)
l_cu_OtherProjectIncomeReceived = RSCurrentExpense.Fields("ProjectIncome")
l_cu_ForfeitureIncomeReceived =
RSCurrentExpense.Fields("ForfeitureIncome")
l_cu_OtherProjectIncomeExpenditures =
RSCurrentExpense.Fields("OtherExpense")
l_cu_ForfeitureIncomeExpenditures =
RSCurrentExpense.Fields("ForfeitureExpense")
l_cu_InterestIncomeReceivedOnMBCCFunds =
RSCurrentExpense.Fields("InterestReceived")
If l_cu_c_InterestIncomeRefunded > 250 then
l_cu_c_InterestIncomeRefunded = (l_cu_c_InterestIncomeRefunded - 250)
Else
l_cu_c_InterestIncomeRefunded = 0
End If
'---------------------------------------------------------------------------------------------
'Now the contact details are handled
l_Remarks = RSCurrentExpense.Fields("Remarks")
l_Name = RSCurrentExpense.Fields("Name")
l_PersonsTitle = RSCurrentExpense.Fields("Title")
l_PhoneAreaCode = RSCurrentExpense.Fields("AreaCode")
l_Phone1 = RSCurrentExpense.Fields("Phone1")
l_Phone2 = RSCurrentExpense.Fields("Phone2")
'l_Date = RSCurrentExpense.Fields("Date")
if isnull(RSCurrentExpense.Fields("Date")) = true then
l_Date = formatdatetime(date, 2)
else
l_Date = RSCurrentExpense.Fields("Date")
end if
End If
l_IsChecked = RSCurrentExpense.Fields("IsChecked") 'This code is added
to handle the check button
%>
Response.Write RSreccountCurrentExpense("reccount") & "<br>"
If RSreccountCurrentExpense("reccount") < 1 Then
Response.Write "Good"
Response.End
For a particular record,I can see that the if staement condition is satisfed
and hence the if statement should be executed.
However, if I comment out Response.End statment to let the whole code
execute I am getting
the error message as shown below. The error message shows that the else
statment is
getting executed and not the if. Once the if statement condition is
satisfied, only the
if statement should be executed and not the else. Cannot figure out why this
is happening.
Any insight to the problem is highly appreciated. Thanks in advance. Regards
ERROR MESSAGE:
Either BOF or EOF is True, or the current record has been deleted. Requested
operation requires a current record.
/gwisbrandnewready6/mainreportagain1.asp, line 745
CODE:
RSreccountCurrentExpense.Open "select COUNT(*) AS reccount from
tblGMISExpenditures_Quarter where SubgrantIntID = " & GrantID & ";"
Response.Write RSreccountCurrentExpense("reccount") & "<br>"
If RSreccountCurrentExpense("reccount") < 1 Then
' Response.Write "Good"
' Response.End
l_cu_CurrentOutlay = 0
l_cu_LocalShareOfOutlay = 0
l_cu_UnpaidObligations = 0
l_cu_LocalShareUnpaidObligations = 0
l_cu_OtherProjectIncomeReceived = 0
l_cu_ForfeitureIncomeReceived = 0
l_cu_OtherProjectIncomeExpenditures = 0
l_cu_ForfeitureIncomeExpenditures = 0
l_cu_InterestIncomeReceivedOnMBCCFunds = 0
l_Remarks = ""
l_Name = ""
l_PersonsTitle = ""
l_PhoneAreaCode = ""
l_Phone1 = ""
l_Phone2 = ""
l_Date = formatdatetime(date,2)
l_IsChecked = "off"
'Note here we need to handle the local variable
Session("l_cu_c_MBCCShareOfOutlays")
'which gets saved in the database on a save command issue.
Session("l_cu_c_MBCCShareOfOutlays") = 0
Else
l_cu_CurrentOutlay = RSCurrentExpense.Fields("CurrentOutlay")
l_c_TotalNetOutlaysToDate = (l_p_TotalOutlay + l_cu_CurrentOutlay)
l_cu_LocalShareOfOutlay = RSCurrentExpense.Fields("LocalShare")
l_cu_c_MBCCShareOfOutlays = (l_cu_CurrentOutlay - l_cu_LocalShareOfOutlay)
'We declare a session variable in order to use this variabel in the
insertorupdatecurrentexpense.asp
Session("l_cu_c_MBCCShareOfOutlays") = l_cu_c_MBCCShareOfOutlays
l_cu_UnpaidObligations = RSCurrentExpense.Fields("UnpaidOblig")
l_cu_LocalShareUnpaidObligations =
RSCurrentExpense.Fields("LocalShareUnpaidOblig")
l_cu_MBCCShareUnpaidObligations = (l_cu_UnpaidObligations -
l_cu_LocalShareUnpaidObligations)
l_cu_c_UnobligatedBalanceMBCCFunds = (l_TotalMBCCFundsAuth -
l_p_c_MBCCShareOutlays - l_cu_c_MBCCShareOfOutlays -
l_cu_MBCCShareUnpaidObligations)
'Note: The following field has already been defined earlier and has been
' assigned a value. Hence, we do not change anything with this field
'except for plugging the value in the right place
'l_TotalLocalMatchAuth
'-------------------------------------------------------------------------------------------------------
l_cu_c_UnobligatedBalanceLocalMatch = (l_TotalLocalMatchAuth -
l_p_LocalShareOfOutlays - l_cu_LocalShareOfOutlay -
l_cu_LocalShareUnpaidObligations)
'------------------------------------------------------------------------------------------------------
'Note: The following field has already been defined earlier and has been
'assigned a value. Hence, we do not change anything with this field
'except for plugging the value in the right place
'l_p_TotalCashDispursed
'-------------------------------------------------------------------------------------------------------
l_cu_c_MBCCCashOnHand = (l_p_TotalCashDispursed -
l_p_c_MBCCShareOutlays - l_cu_c_MBCCShareOfOutlays)
l_cu_OtherProjectIncomeReceived = RSCurrentExpense.Fields("ProjectIncome")
l_cu_ForfeitureIncomeReceived =
RSCurrentExpense.Fields("ForfeitureIncome")
l_cu_OtherProjectIncomeExpenditures =
RSCurrentExpense.Fields("OtherExpense")
l_cu_ForfeitureIncomeExpenditures =
RSCurrentExpense.Fields("ForfeitureExpense")
l_cu_InterestIncomeReceivedOnMBCCFunds =
RSCurrentExpense.Fields("InterestReceived")
If l_cu_c_InterestIncomeRefunded > 250 then
l_cu_c_InterestIncomeRefunded = (l_cu_c_InterestIncomeRefunded - 250)
Else
l_cu_c_InterestIncomeRefunded = 0
End If
'---------------------------------------------------------------------------------------------
'Now the contact details are handled
l_Remarks = RSCurrentExpense.Fields("Remarks")
l_Name = RSCurrentExpense.Fields("Name")
l_PersonsTitle = RSCurrentExpense.Fields("Title")
l_PhoneAreaCode = RSCurrentExpense.Fields("AreaCode")
l_Phone1 = RSCurrentExpense.Fields("Phone1")
l_Phone2 = RSCurrentExpense.Fields("Phone2")
'l_Date = RSCurrentExpense.Fields("Date")
if isnull(RSCurrentExpense.Fields("Date")) = true then
l_Date = formatdatetime(date, 2)
else
l_Date = RSCurrentExpense.Fields("Date")
end if
End If
l_IsChecked = RSCurrentExpense.Fields("IsChecked") 'This code is added
to handle the check button
%>