Next and Previous Buttons

J

James

Hello,
I have the following code but I need some assistance with
it as you can see I have some of it (dont know if its
right) but I just need a little bit adding...

cmd1 = Next Button
cmd2 = Previous Button

*Code Starts*

If ID < 1 Then
cmd1.enabled = False Else
cmd1.eabled = True
End If

If ID = *Need end of record code here* Then
cmd2.enabled = False Else
cmd2.enabled = True
End If

*Code Ends*

Hows the above... This is all I need the little bit of
code to say the end of the records.... also is my Code
correct is also what I am asking for assistance on...

Many Thanks

James
 
E

Erez

hello
what i use is the recordset of the form
'Prev:
me.recordset.moveprevious
if me.recordset.bof then me.recordset.movefirst
'Next:
me.recordset.movenext
if me.recordset.eof then me.recordset.movelast

using bof(beginning of file-before the first record) and
eof(end of file-after the last record), you can tell the
relative position in the recordset
(this method is possible if the form is bound.
hope this helps
Erez.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top