if statement not properly executing which is leading to error mess
am 05.03.2005 00:05:02 von jackHi,
I have asp page where it acts as a form with numerous recordsets, few for
retrieval and few for saving and retrieval.
One of the recordset is shown as below. Here for a particular record, I am
getting the error message as:
ADODB.Field (0x800A0BCD)
Either BOF or EOF is True, or the current record has been deleted. Requested
operation requires a current record.
/gwisbrandnewready6/mainreportagain1.asp, line 742
The line 742 is way at the bottom of the code which is
l_IsChecked = RSCurrentExpense.Fields("IsChecked") 'This code is added
to handle the check button
I have tested this record in Access(corresponding to the recordset) and
found that the reccount value is 0, as this record does not yet exists in the
table. With this condition however, the first part of the if statement should
have been executed.
By looking at the error it seems the else part of the if statement is
executed here. I am not sure why this is happening. Any
help in advance is higly appreciated. Thanks in advance.
CODE:
RSreccountCurrentExpense.Open "select COUNT(*) AS reccount from
tblGMISExpenditures_Quarter where SubgrantIntID = " & GrantID & ";"
If RSreccountCurrentExpense("reccount") < 1 Then
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")
'Response.Write "Current Outlay" & "
"
'Response.Write l_cu_CurrentOutlay & "
"
'Response.Write l_cu_CurrentOutlay & "
"
'Response.Write "Cool" & "
"
l_c_TotalNetOutlaysToDate = (l_p_TotalOutlay + l_cu_CurrentOutlay)
'Response.Write l_c_TotalNetOutlaysToDate & "
"
'Response.Write "Cool" & "
"
l_cu_LocalShareOfOutlay = RSCurrentExpense.Fields("LocalShare")
'Response.Write "Local Share Of Outlay" & "
"
'Response.Write l_cu_LocalShareOfOutlay & "
"
'Response.Write "Cool" & "
"
l_cu_c_MBCCShareOfOutlays = (l_cu_CurrentOutlay - l_cu_LocalShareOfOutlay)
'Response.Write "MBCC Share Of Outlay" & "
"
'Response.Write l_cu_c_MBCCShareOfOutlays & "
"
'Response.Write "Cool" & "
"
'We declare a session variable in order to use this variabel in the
insertorupdatecurrentexpense.asp
Session("l_cu_c_MBCCShareOfOutlays") = l_cu_c_MBCCShareOfOutlays
'Response.Write "Session MBCC Share Of Outlay" & "
"
'Response.Write Session("l_cu_c_MBCCShareOfOutlays") & "
"
'Response.Write "Cool" & "
"
l_cu_UnpaidObligations = RSCurrentExpense.Fields("UnpaidOblig")
'Response.Write l_cu_UnpaidObligations & "
"
'Response.Write "Cool" & "
"
l_cu_LocalShareUnpaidObligations =
RSCurrentExpense.Fields("LocalShareUnpaidOblig")
'Response.Write l_cu_LocalShareUnpaidObligations & "
"
'Response.Write "Cool" & "
"
l_cu_MBCCShareUnpaidObligations = (l_cu_UnpaidObligations -
l_cu_LocalShareUnpaidObligations)
'Response.Write l_cu_MBCCShareUnpaidObligations & "
"
'Response.Write "Cool" & "
"
'----------------------------------------------------------- -----------------------------------------
'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_TotalMBCCFundsAuth
'----------------------------------------------------------- -------------------------------------------
l_cu_c_UnobligatedBalanceMBCCFunds = (l_TotalMBCCFundsAuth -
l_p_c_MBCCShareOutlays - l_cu_c_MBCCShareOfOutlays -
l_cu_MBCCShareUnpaidObligations)
'Response.Write l_cu_c_UnobligatedBalanceMBCCFunds & "
"
'Response.Write "Cool" & "
"
'----------------------------------------------------------- -------------------------------------------
'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)
'Response.Write l_cu_c_UnobligatedBalanceLocalMatch & "
"
'Response.Write "Cool" & "
"
'----------------------------------------------------------- -------------------------------------------
'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)
'Response.Write l_cu_c_MBCCCashOnHand & "
"
'Response.Write "Cool" & "
"
l_cu_OtherProjectIncomeReceived = RSCurrentExpense.Fields("ProjectIncome")
'Response.Write l_cu_OtherProjectIncomeReceived & "
"
'Response.Write "Cool" & "
"
l_cu_ForfeitureIncomeReceived =
RSCurrentExpense.Fields("ForfeitureIncome")
'Response.Write l_cu_ForfeitureIncomeReceived & "
"
'Response.Write "Cool" & "
"
l_cu_OtherProjectIncomeExpenditures =
RSCurrentExpense.Fields("OtherExpense")
'Response.Write l_cu_OtherProjectIncomeExpenditures & "
"
'Response.Write "Cool" & "
"
l_cu_ForfeitureIncomeExpenditures =
RSCurrentExpense.Fields("ForfeitureExpense")
'Response.Write l_cu_ForfeitureIncomeExpenditures & "
"
'Response.Write "Cool" & "
"
l_cu_InterestIncomeReceivedOnMBCCFunds =
RSCurrentExpense.Fields("InterestReceived")
'Response.Write l_cu_InterestIncomeReceivedOnMBCCFunds & "
"
'Response.Write "Cool" & "
"
If l_cu_c_InterestIncomeRefunded > 250 then
l_cu_c_InterestIncomeRefunded = (l_cu_c_InterestIncomeRefunded - 250)
Else
l_cu_c_InterestIncomeRefunded = 0
End If
'Response.Write l_cu_c_InterestIncomeRefunded & "
"
'Response.Write "Cool" & "
"
'----------------------------------------------------------- ----------------------------------
'Now the contact details are handled
l_Remarks = RSCurrentExpense.Fields("Remarks")
'Response.Write l_Remarks & "
"
'Response.Write "Cool" & "
"
l_Name = RSCurrentExpense.Fields("Name")
'Response.Write l_Name & "
"
'Response.Write "Cool" & "
"
l_PersonsTitle = RSCurrentExpense.Fields("Title")
'Response.Write l_PersonsTitle & "
"
'Response.Write "Cool" & "
"
l_PhoneAreaCode = RSCurrentExpense.Fields("AreaCode")
'Response.Write l_PhoneAreaCode & "
"
'Response.Write "Cool" & "
"
l_Phone1 = RSCurrentExpense.Fields("Phone1")
'Response.Write l_Phone1 & "
"
'Response.Write "Cool" & "
"
l_Phone2 = RSCurrentExpense.Fields("Phone2")
'Response.Write l_Phone2 & "
"
'Response.Write "Cool" & "
"
'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
'Response.Write l_Phone2 & "
"
'Response.Write "Cool" & "
End If
' Response.Write "Start of Session Variable" & "
"
' Response.Write Session("l_cu_c_MBCCShareOfOutlays") & "
"
' Response.Write "End of Session Variable" & "
"
l_IsChecked = RSCurrentExpense.Fields("IsChecked") 'This code is added
to handle the check button
' Response.Write "Start Of ISchecked" & "
"
' Response.Write l_IsChecked & "
"
' Response.Write "Cool" & "
"
%>
<%
if cbool(l_IsChecked) then
' isDisabled = " disabled "
isReadOnly = " readonly "
else
' isDisabled = " "
isReadOnly = " "
end if