karuri73088
Technical User
I have two recordsets in which rs and rs1. In rs I have results of candidates courseid, mark, date etc. in rs1 I have courses with their passmarks. I would like to filter in a listview between two dates then compare the mark in rs with the passmark in rs1. Any hints??? I have the following code but it only compares all the marks in rs with only the first passmark in rs1. Your help will be appreciated. Part of my code is as follows. Thanks
If Not (rs.BOF And rs.EOF) Then
rs.MoveFirst
With rs
.Filter = "ResultDate <> null "
Do While Not .EOF
rs1.MoveFirst
If !courseid = rs1.Fields!courseid Then
k = rs1.Fields!PassMark
Else
rs1.MoveNext
End If
If !Mark >= k Then
If !ResultDate >= h Then
If !ResultDate <= i Then
Set strlistItem = ListView.ListItems.Add(, , rs!CandidateID)
strlistItem.SubItems(1) = !ModuleID
strlistItem.SubItems(2) = !courseid
strlistItem.SubItems(3) = !ResultDate
strlistItem.SubItems(4) = !Mark
End If
End If
End If
.MoveNext
Loop
.Filter = adFilterNone
End With
End If
End Sub
If Not (rs.BOF And rs.EOF) Then
rs.MoveFirst
With rs
.Filter = "ResultDate <> null "
Do While Not .EOF
rs1.MoveFirst
If !courseid = rs1.Fields!courseid Then
k = rs1.Fields!PassMark
Else
rs1.MoveNext
End If
If !Mark >= k Then
If !ResultDate >= h Then
If !ResultDate <= i Then
Set strlistItem = ListView.ListItems.Add(, , rs!CandidateID)
strlistItem.SubItems(1) = !ModuleID
strlistItem.SubItems(2) = !courseid
strlistItem.SubItems(3) = !ResultDate
strlistItem.SubItems(4) = !Mark
End If
End If
End If
.MoveNext
Loop
.Filter = adFilterNone
End With
End If
End Sub