Form Record Navigation

F

Fred

Dear Group:

I have built a form, using the wizard to put command
buttons that will move to the NEXT record or PREVIOUS
record. This works, but it needs some refinement.

Presently, if I am on the first record and click the
PREVIOUS record button, I get some built in, generic
Access message. And, if I am on the last record and I
click the NEXT record button, I am advanced to the *new*
record row in the table.

What I would like to happen:
When the form opens the PREVIOUS button is disabled. As
soon as the NEXT is clicked the PREVIOUS button becomes
enabled. Once I reach the final record, the NEXT button
becomes disabled. In short- disable/enable buttons as
needed.

This is what I tried:
In the form's *On Current* event I put the code found
below. It doesn't work. When the form opens, both buttons
are disabled. Any help or pointers would be appreciated.
Thanks. (version- Access 2002)


cmdPrevious.Enabled = Not Me.CurrentRecord = 1
cmdNextRace.Enabled = Not Me.CurrentRecord =
Me.RecordsetClone.RecordCount
 
C

Cheryl Fischer

If you'll step through your code when the form opens, you will see that
Me.RecordsetClone.RecordCount = 1. Insert the following line before your
code to enable/disable the buttons:

Me.RecordsetClone.MoveLast
 

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