how to detect first n last record? Thank you

racerrunner

Registered User.
Local time
Today, 10:11
Joined
May 29, 2005
Messages
32
Hi all,

If I have 10 records in the DB How to write a prgm to calculate the number of records in the DB?

Also, how do i write a prg that will detect the last n first record?

I.E

When i click on the navigation bar "next record"(I intend to program my own navigation bar) For instance, I'm at record Number 10, is it possible to write a code that will tell me that there is no more record to view when i click on the navigation bar "next record"?

Thank you.
 
Why are you reinventing the wheel? There are plenty of examples in the forum. Searching around will help you get to where you want to go.

Code:
Private Sub bPrevious_Click()
 
    If Me.Dirty Then
        MsgBox "Please Save This Record!" & vbCrLf & vbLf & "You can not advance from this record until you either 'Save' the changes made to this record or 'Undo' your changes.", vbExclamation, "Save Required"
    ElseIf Me.CurrentRecord > 1 Then
        DoCmd.GoToRecord , , acPrevious
    End If
    
End Sub
Code:
Private Sub bNext_Click()
     
    If Me.Dirty Then
        MsgBox "Please Save This Record!" & vbCrLf & vbLf & "You can not advance from this record until you either 'Save' the changes made to this record or 'Undo' your changes.", vbExclamation, "Save Required"
    ElseIf Me.CurrentRecord < Me.RecordsetClone.RecordCount Then
        DoCmd.GoToRecord , , acNext
    End If
     
End Sub

Also, this will help you get your record counter >>> Record X of Y
 
Last edited:

Users who are viewing this thread

Back
Top Bottom