Issue on form GoTo Next Record (1 Viewer)

sandya

Registered User.
Local time
Today, 08:40
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.
 

sandya

Registered User.
Local time
Today, 08:40
Joined
Oct 27, 2013
Messages
82
Please replay can anyone how to do changes?? :confused:
 

Old Man Devin

Consul Of Code
Local time
Today, 04:10
Joined
Jan 10, 2014
Messages
183
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 :)
 

sandya

Registered User.
Local time
Today, 08:40
Joined
Oct 27, 2013
Messages
82
Thank you so much Dear...:) its working Perfectly..
 

Users who are viewing this thread

Top Bottom