goto nextrecord when it is currently lastrecord

keybs

Registered User.
Local time
Today, 14:57
Joined
Aug 16, 2001
Messages
12
Hello all,
I have a query that is interfaced through a form. I add new information and press a button to save the info and move to the next record. When I am already on the last record I get an error when I press the next record button because there are no more records. How do I do a check that says if I am on the last record and press the next record button then do.....

I know there must be something like

If CurrentRecord = LastRecord Then
...

I just cant seem to find it..

Brandon
 
You could have a button on your form with this procedure in the on click event.

Option Compare Database
Option Explicit

Dim Message as String
Dim DialogType as Integer
Dim Title as String
Dim Response as Integer

Private Sub cmdNext_Click()
Message = "Last Record" & Chr(13) & "Click OK to Continue"
DialogType = vbOKOnly + vbExclamation
Title = "Next Record Warning"
On Error GoTo Err_cmdNext_Click

DoCmd.GoToRecord , , acNext
Exit_cmdNext_Click:
Exit Sub

Err_cmdNext_Click:
Response = MsgBox(Message, DialogType, Title)
Resume Exit_cmdNext_Click


End Sub


Is this what you were looking for?

Hope this helps you out.

D.J.

[This message has been edited by DJBummy (edited 08-24-2001).]

[This message has been edited by DJBummy (edited 08-24-2001).]

[This message has been edited by DJBummy (edited 08-24-2001).]
 
Thanks so much thats what I needed!
 

Users who are viewing this thread

Back
Top Bottom