Navigate in alphabetical order?

Clueless Newbie

Immortal. So far.
Local time
Tomorrow, 00:01
Joined
Feb 6, 2004
Messages
48
Hi all!

I was wondering: Is it possible to create a navigation button that finds my current/open recordset and takes me to the next recordset in alphabetical order, even though my primary key is a numerical ID?

How would I go about this? Can I combine "DoCmd.GoToRecord , , acPrevious" or "DoCmd.GoToRecord , , acNext" with a select statement somehow ("... ORDER BY Name")? Does anyone have an idea by any chance?

Thanks a bunch and have a nice day! :)

Ute
 
Why don't you navigate an ordered query rather than a table. ;)
 
Great idea, thanks a bunch! :)

Just in case anyone is interested:

Query "navigation" = SELECT DISTINCTROW Daten.Kunde, Daten.KundenNr, Daten.ID FROM Daten WHERE (((Daten.deleted)=False)) ORDER BY Kunde, ID;

Navigation code:

Private Sub Forward_Click()
Dim db As DAO.Database
Dim rs As DAO.Recordset
Set db = CurrentDb
Set rs = db.OpenRecordset("navigation")
rs.FindFirst ("id=" & Me!id)

If rs.EOF Then
rs.MoveFirst
Else
With rs
.MoveNext
End With
End If
Call Auswahl(rs!id)
End Sub
-------------------------
Private Sub Back_Click()
Dim db As DAO.Database
Dim rs As DAO.Recordset
Set db = CurrentDb
Set rs = db.OpenRecordset("navigation")
rs.FindFirst ("id=" & Me!id)

If rs.BOF Then
rs.MoveLast
Else
With rs
.MovePrevious
End With
End If
Call Auswahl(rs!id)
End Sub
 

Users who are viewing this thread

Back
Top Bottom