Form Record Navigation

  • Thread starter Thread starter Fred
  • Start date Start date
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
 
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
 
Back
Top