|
-
Feb 16th, 2004, 12:23 PM
#1
Thread Starter
Lively Member
Date1 > Date2 then add date1
Hello
I got this frekin problem with my code i kept changing it again and agian i tried different ways also but always got the same problem "err no 3021 either bof or eof is true or record has been deleted"
i got 2 recordsets open with a date filed
Find the smaller date between the 2 record sets then add it to listview keep looping untill all the fields are added
basicly im trying to put the date in Desending order
-
Feb 16th, 2004, 01:54 PM
#2
Lively Member
Are you testing for the recordset returning an actual recordset?
-
Feb 16th, 2004, 06:47 PM
#3
Fanatic Member
I am pretty sure that the amount of records you have in both your recordset are not equal. So when you are looping through it, one of the recordset runs out of records and you are still trying to loop through it. The best way to do this is put a break point in your code and see where it errors. You can also check how many records you have in each recordset by looking at the RecordCount property for the recordset.
Motto: Anything for a laugh.
Getting second place only means you are the first loser to cross the finish line.
-
Feb 16th, 2004, 09:27 PM
#4
Thread Starter
Lively Member
Here is my freakin code
VB Code:
TotRsCount = Rs.RecordCount + Sales_Rs.Recourdcount
Do untill i = TotRsCount
'MsgBox P_Date & " " & S_Date & " Loop No: " & i
If P_Date > S_Date Then
If RS.EOF = False Then
lblRemark = i
Set Itmx = lvDetail.ListItems.Add
Itmx.Text = RS("TransID")
Itmx.SubItems(1) = RS("InvoiceNo")
Itmx.SubItems(2) = RS("PartyID")
Itmx.SubItems(3) = RS("Qty")
'Itmx.SubItems(4) =
Itmx.SubItems(5) = RS("Amount")
Itmx.SubItems(6) = RS("P_Date")
Itmx.SubItems(7) = RS("Date_Time")
End If
If Not RS.EOF = True Then
RS.MoveNext
P_Date = RS("P_Date")
i = i + 1
End If
End If
If S_Date > P_Date Then
If Sales_Rs.EOF = False Then
lblRemark = i
Set Itmx = lvDetail.ListItems.Add
Itmx.Text = Sales_Rs("TransID")
Itmx.SubItems(1) = Sales_Rs("InvoiceNo")
Itmx.SubItems(2) = Sales_Rs("CsID")
Itmx.SubItems(3) = Sales_Rs("Qty")
Itmx.SubItems(4) = Sales_Rs("SP") & "(" & Sales_Rs("Discount") & ")"
Itmx.SubItems(5) = Sales_Rs("Amount")
Itmx.SubItems(6) = Sales_Rs("S_Date")
Itmx.SubItems(7) = RS("Date_Time")
End If
If Not Sales_Rs.EOF = True Then
Sales_Rs.MoveNext
S_Date = Sales_Rs("S_Date")
i= i + 1 '
End If
End If
ChkLoop = ChkLoop + 1 ' StoP Loop if chkloop is more than TotRsCount
'MsgBox "ChkLoop: " & ChkLoop & " LoopNo :" & i
If ChkLoop > TotRsCount Then
MsgBox "i= " & i & " ChkLoop = " & ChkLoop
Exit For
End If
Loop
Last edited by internet_wiz; Feb 16th, 2004 at 09:32 PM.
-
Feb 17th, 2004, 09:09 AM
#5
Thread Starter
Lively Member
Any ideas??
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|