Issue on form GoTo Next Record

sandya

Registered User.
Local time
Today, 16:54
Joined
Oct 27, 2013
Messages
82
Hello can anyone help on my issue,

I have created Command buttons on forms with VBA code. Records GoTo previous and GoTo Next Record so both of working is good. But Next Record command is force to a new record. If suppose when we clicking on last record. It is go to new record without any message. So No need to force a new record with Next Record Command. Only just move to next record if there is no records show a message. Below mentioned both VBA codes so there is any changes on GoTo Next Record Code?? please replay anyone. :banghead:

VBA Code:
Go To Previous Record : DoCmd.GoToRecord , , acPrevious
Go To Next Record : DoCmd.GoToRecord , , acNext


Thanks,
Sandhya.
 
Please replay can anyone how to do changes?? :confused:
 
You will need to check to see if you are on the last record in the code and if so not have it move to the next one. For example:
Code:
If Me.CurrentRecord < Me.Recordset.RecordCount Then
    DoCmd.GoToRecord , , acNext 
Else
    '[If the condition is not true, then we are on the last record, so don't go to the next one]
End If

Hope this helps you out :)
 
Thank you so much Dear...:) its working Perfectly..
 

Users who are viewing this thread

Back
Top Bottom