Having a mess o' seeks in my DAO/Jet old code, I've been giving this a lot
of thought lately, i.e, duplicating SEEK functionality with SQL7.
I'm looking for ideas on the ability to walk through the entire data set in
different orders. For example....
In my VB app the user can PgDn / PgUp in the Last Name field and cycle
through the records in alphabetical order from BOF to EOF if they wanted to
(in JET Last_Name is indexed). Or further, they could type, say, "SMITH",
then hit PgDn and scroll from that point on. Same deal for the Phone Number
or City fields, etc.
Gee....anyone remember Dataflex? :)
The following abbreviated code works fine in DAO and even in
ADO/Jet.OLEDB.4.0, but I suspect I may have significant trouble using this
mentality with SQL7:
Sub Record_Next(rs As Recordset, Index%)
'
' Fired by the PgDn...Move to the next record in the index.
'
rs.Index = Main.ActiveForm.Field(Index%).Tag ' Get the index name.
rs.Seek Main.ActiveForm.Field(Index%).Text, adSeekAfterEQ
If rs.EOF And rs.RecordCount > 0 Then rs.MoveLast
Else
rs.MoveNext
End If
If rs.EOF Or rs.RecordCount = 0 Then ' End of file?
Beep
Main.StatusPanel1 = "Find Past End Of File"
If rs.RecordCount > 0 Then rs.MoveLast
Exit Sub
End If
Call Fields_Write(rs)
End Sub
Anyone have any thoughts or comments? Is it beginning to sound like I may
have to start making copious use of bookmarks and record positions?
...Chris.