I use a list view to pick out a record which fill data on a separate form. Then if I want to scroll through the database from the present record, I have two arrows to move forward or backwards.
The database is indexed on fldTitle. fldTitle is not unique to one record for two artists can be working together i.e. Getz & Mulligan if I want to show all works for a particular artist.
When I get to the first title of duplication, the move next button stops after showing both artists of the same title. When I move previous and get to the first title of duplication, the button skips the second record and moves to the next title.
Here is my code for both:
Any help would be great. Thanx.
The database is indexed on fldTitle. fldTitle is not unique to one record for two artists can be working together i.e. Getz & Mulligan if I want to show all works for a particular artist.
When I get to the first title of duplication, the move next button stops after showing both artists of the same title. When I move previous and get to the first title of duplication, the button skips the second record and moves to the next title.
Here is my code for both:
Code:
Private Sub MoveNext()
sSql = "SELECT * FROM Artists ORDER BY fldTitle"
If rs.State = adStateOpen Then rs.Close
rs.Open sSql, cn, adOpenKeyset, adLockOptimistic, adCmdText
Do Until rs.Fields("fldTitle").Value = frmSSTab.txtTitle.Text
rs.MoveNext
Loop
rs.MoveNext
If rs.EOF Then
rs.MoveFirst
If rs.BOF Then
Exit Sub
End If
End If
End Sub
Private Sub MovePrevious()
sSql = "SELECT * FROM Artists ORDER BY fldTitle"
If rs.State = adStateOpen Then rs.Close
rs.Open sSql, cn, adOpenKeyset, adLockOptimistic, adCmdText
Do Until rs.Fields("fldTitle").Value = frmSSTab.txtTitle.Text
rs.MoveNext
Loop
rs.MovePrevious
If rs.BOF Then
rs.MoveLast
If rs.EOF Then
Exit Sub
End If
End If
End Sub
Any help would be great. Thanx.