Click here to Skip to main content
15,919,613 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Dear All,

I am getting the error:"Either EOF Or BOF is true, Or the current record has been deleted" when I click the process button which has the following code:

Cnn.BeginTrans
Cnn.Execute ("Delete from ClaimAndPromoMergeData")
Cnn.Execute ("Proc_MergeClaimAndPromo")
Cnn.Execute ("Delete from ArrowOutput")
SQL = "Insert Into ArrowOutput SELECT DISTINCT STM.[Buyer - Company ID], STM.[Buyer - Company Name], STM.[Buyer - Location ID]," & _
"STM.[Buyer - Location Post City], STM.[Buyer - Location Post State], STM.[Fiscal Quarter], STM.[Fiscal Month], STM.[Product Line ID]," & _
"STM.[Product Number (SKU)], STM.[Product Type], STM.[Product Class], STM.[RAS Model], STM.[RAS Family], STM.[RAS Product], STM.GBU, STM.Segment," & _
"STM.[Seller - Company ID], STM.[Seller - Company Name], STM.[Trans Date], STM.[Trans Doc ID], STM.[Trans Doc Type], STM.[Buyer - Location Channel Segment]," & _
"STM.[Buyer - Channel Membership], STM.[Buyer - Location Name], STM.[Submitted Txn Unit ST@LC(IN&SP Only)], STM.[Relationship Sell Thru Qty]," & _
"STM.[Relationship Sell Thru Option Qty], STM.[Relationship Sell Thru @ USD], STM.[Eclipse ID], '' AS [Eligible-Not Eligible], '' AS [Eligible Qty]," & _
"AM.[Claim Line Item ID],AM.[Claim Line Item Status],DM.[Denial_comment] As [Claim Denial Error Comment1]" & _
"FROM denial_master AS DM,SellThruMaster AS STM Inner Join ClaimAndPromoMergeData AS AM On (((STM.[Product Number (SKU)])=[AM].[Product Number (SKU)]) AND " & _
"((STM.[Seller - Company ID])=[AM].[Seller - Company ID]) AND ((STM.[Trans Date])=[AM].[Trans Date]) AND ((STM.[Trans Doc ID])=[AM].[Trans Doc ID])  AND ((AM.[Claim Line Item Status])='Eligible')) Where DM.[Denial_code]=AM.[Claim Denial Error Code 1]"
Cnn.Execute (SQL)

SQL1 = "Insert Into ArrowOutput Select Distinct STM.[Buyer - Company ID],STM.[Buyer - Company Name],STM.[Buyer - Location ID]," & _
"STM.[Buyer - Location Post City],STM.[Buyer - Location Post State],STM.[Fiscal Quarter],STM.[Fiscal Month],STM.[Product Line ID]," & _
"STM.[Product Number (SKU)],STM.[Product Type],STM.[Product Class],STM.[RAS Model],STM.[RAS Family],STM.[RAS Product]," & _
"STM.[GBU],STM.[Segment],STM.[Seller - Company ID],STM.[Seller - Company Name],STM.[Trans Date],STM.[Trans Doc ID]," & _
"STM.[Trans Doc Type],STM.[Buyer - Location Channel Segment],STM.[Buyer - Channel Membership],STM.[Buyer - Location Name]," & _
"STM.[Submitted Txn Unit ST@LC(IN&SP Only)],STM.[Relationship Sell Thru Qty],STM.[Relationship Sell Thru Option Qty]," & _
"STM.[Relationship Sell Thru @ USD],STM.[Eclipse ID],'' As [Eligible-Not Eligible],'' As [Eligible Qty]," & _
"AM.[Claim Line Item ID],AM.[Claim Line Item Status],DM.[Denial_comment] As [Claim Denial Error Comment1]" & _
"FROM denial_master AS DM,SellThruMaster AS STM Inner Join ClaimAndPromoMergeData AS AM On (((STM.[Product Number (SKU)])=[AM].[Product Number (SKU)]) AND " & _
"((STM.[Seller - Company ID])=[AM].[Seller - Company ID]) AND ((STM.[Trans Date])=[AM].[Trans Date]) AND ((STM.[Trans Doc ID])=[AM].[Trans Doc ID])  AND ((AM.[Claim Line Item Status])='Non-Eligible')) Where DM.[Denial_code]=AM.[Claim Denial Error Code 1]"
Cnn.Execute (SQL1)

'Not Eligible - Other
'Update Eligible Status and qty
Set Rec = New ADODB.Recordset
Rec.Open "Select * from ArrowOutput", Cnn, adOpenDynamic, adLockOptimistic
Do Until Rec.EOF
SQL = "Select IIF(Sum(IIf([Claim Line Item Status]='Eligible',1,0))>0,'Eligible','Not Eligible - Others') As Status," & _
"Sum(IIf([Claim Line Item Status]='Eligible',1,0)) As EligibleQty " & _
"from ClaimAndPromoMergeData Where [Product Number (SKU)]='" & Rec.Fields("Product Number (SKU)") & "' And " & _
"[Seller - Company ID]='" & Rec.Fields("Seller - Company ID") & "' And [Trans Date]=#" & Format(Rec.Fields("Trans Date"), "dd-mmm-yyyy") & _
"# And [Trans Doc ID] ='" & Rec.Fields("Trans Doc ID") & "' And [Claim Line Item Status]='Eligible'"
Rec1.Open SQL, Cnn
If Not Rec1.EOF Then
    Rec.Fields("Eligible-Not Eligible") = Rec1.Fields("Status") & ""
    Rec.Fields("Eligible Qty") = Rec1.Fields("EligibleQty") & ""
    'Rec.Fields("NonEligibleQty") = Rec1.Fields("NonEligibleQty") & ""
End If
Rec1.Close
Rec.MoveNext
SQL1 = "Select IIF(Sum(IIf([Claim Line Item Status]='Non-Eligible',1,0))>0,'Not Eligible - Others','Eligible') As Status," & _
"Sum(IIf([Claim Line Item Status]='Non-Eligible',1,0)) As EligibleQty " & _
"from ClaimAndPromoMergeData Where [Product Number (SKU)]='" & Rec.Fields("Product Number (SKU)") & "' And " & _
"[Seller - Company ID]='" & Rec.Fields("Seller - Company ID") & "' And [Trans Date]=#" & Format(Rec.Fields("Trans Date"), "dd-mmm-yyyy") & _
"# And [Trans Doc ID] ='" & Rec.Fields("Trans Doc ID") & "' And [Claim Line Item Status]='Non-Eligible'"
Rec1.Open SQL1, Cnn
If Not Rec1.EOF Then
    Rec.Fields("Eligible-Not Eligible") = Rec1.Fields("Status") & ""
    'Rec.Fields("Eligible Qty") = Rec1.Fields("EligibleQty") & ""
    Rec.Fields("Eligible Qty") = Rec1.Fields("EligibleQty") & ""
End If
Rec1.Close
Rec.MoveNext
Loop
Rec.UpdateBatch
Cnn.CommitTrans
Rec.Close


Here I am using two different queries SQL and SQL1. I have a doubt in If statement after the conn.execute(SQL1). I have pasted the lengthy code and sorry for this. But I have to paste this entire code for undrestanding the issue.
Please any one suggest me on this issue.

Regards,
Posted
Comments
DaveAuld 2-Jul-11 15:47pm    
Stick a breakpoint on the very first line of the code, and then step through the code line by line, it will fail on the line that is causing the problem, then take it form there.

1 solution

There are several possibilities why you are receiving this error. Since you didn't provide the line where your code fails I suggest you read this article:
http://classicasp.aspfaq.com/general/why-do-i-get-bof-or-eof-errors.html[^]

I would start with locating the line where the error occurs and then add select queries to test the number of rows in the table(s). Perhaps one of the queries contains an error.

If this does not solve your problem then I suggest you read this article. Perhaps this gives you some ideas.
http://www.tek-tips.com/viewthread.cfm?qid=1108921&page=244[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900