'Smart' navigation (1 Viewer)

Chrisopia

Registered User.
Local time
Today, 10:22
Joined
Jul 18, 2008
Messages
279
I was searching the internet for the best way to add 'smart' navigation, and I thought I'd share my make-shift solution.

Apparently it's not very obvious?

I am talking about the "first" and "last" and "next" and "previous" buttons which annoyingly will go to a new record if it's the end of the search.
One solution wanted me to dive into RecordSet and play around with that... but I think my solution is quick and simple.

If you can improve on it, feel free to add.

Code:
Dim TheCount As Integer
Dim TheCurrent As Integer

TheCount = DCount("InvoiceNumber", "qryInvoiceDateSearch")
TheCurrent = CurrentRecord

If (TheCount = 1) Then
LastR.Enabled = False
NextR.Enabled = False
PrevR.Enabled = False
FirstR.Enabled = False
ElseIf (TheCount = TheCurrent) Then
LastR.Enabled = False
NextR.Enabled = False
PrevR.Enabled = True
FirstR.Enabled = True
ElseIf (TheCurrent = 1) Then
LastR.Enabled = True
NextR.Enabled = True
PrevR.Enabled = False
FirstR.Enabled = False
Else
LastR.Enabled = True
NextR.Enabled = True
PrevR.Enabled = True
FirstR.Enabled = True
End If
 

Users who are viewing this thread

Top Bottom