By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,705 Members | 1,852 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,705 IT Pros & Developers. It's quick & easy.

Controlling "Next record" button

P: n/a
Tim
I have used a graphic 'next record' button on a form. How can I stop it
from going past the last existing record? In other words, I don't want it
to take the user to a blank record.

Thanks
Tim
Nov 13 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
You have to have some code for that button. Check in the code... the Form's
RecordsetClone is one source. If you can't determine how, clarify by posting
the code you are using and perhaps someone can make a more concrete
suggestion.

Larry Linson
Microsoft Access MVP
"Tim" <tg@neo.rr.com> wrote in message
news:GQ*******************@fe2.columbus.rr.com...
I have used a graphic 'next record' button on a form. How can I stop it
from going past the last existing record? In other words, I don't want it
to take the user to a blank record.

Thanks
Tim

Nov 13 '05 #2

P: n/a
In message <GQ*******************@fe2.columbus.rr.com>, Tim
<tg@neo.rr.com> writes
I have used a graphic 'next record' button on a form. How can I stop it
from going past the last existing record? In other words, I don't want it
to take the user to a blank record.


This code traps that specific error and beeps if the user attempts to go
beyond the last record. The code is in the On Click event handler for a
control called GoNext.

--------------8<--------------------------------------------------8<-----
--------

Private Sub GoNext_Click()
On Error GoTo Err_GoNext_Click
DoCmd.GoToRecord , , acNext

Exit_GoNext_Click:
Exit Sub

Err_GoNext_Click:
If Err = 2105 Then
Beep
Else
MsgBox (Str(Err) & " - " & Err.DESCRIPTION)
End If
Resume Exit_GoNext_Click
End Sub

--
Bernard Peek
London, UK. DBA, Manager, Trainer & Author. Will work for money.

Nov 13 '05 #3

P: n/a
Bernard,

Using this code, the button still takes me to a blank record at the end and
beeps.
Tim

"Bernard Peek" <ba*@shrdlu.com> wrote in message
news:Ih**************@shrdlu.com...
In message <GQ*******************@fe2.columbus.rr.com>, Tim
<tg@neo.rr.com> writes
I have used a graphic 'next record' button on a form. How can I stop it
from going past the last existing record? In other words, I don't want itto take the user to a blank record.


This code traps that specific error and beeps if the user attempts to go
beyond the last record. The code is in the On Click event handler for a
control called GoNext.

--------------8<--------------------------------------------------8<-----
--------

Private Sub GoNext_Click()
On Error GoTo Err_GoNext_Click
DoCmd.GoToRecord , , acNext

Exit_GoNext_Click:
Exit Sub

Err_GoNext_Click:
If Err = 2105 Then
Beep
Else
MsgBox (Str(Err) & " - " & Err.DESCRIPTION)
End If
Resume Exit_GoNext_Click
End Sub

--
Bernard Peek
London, UK. DBA, Manager, Trainer & Author. Will work for money.

Nov 13 '05 #4

P: n/a
In message <M7*******************@fe2.columbus.rr.com>, Tim Graichen
<Tg*******@neo.rr.com> writes
Bernard,

Using this code, the button still takes me to a blank record at the end and
beeps.
Tim


Sorry, it was only half the solution. Check the form properties and set
"Allow Additions" to no.
--
Bernard Peek
London, UK. DBA, Manager, Trainer & Author. Will work for money.

Nov 13 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.