Dynamic Form Nav Buttons

  • Thread starter Thread starter SrA Michael Roszkowski USAF
  • Start date Start date
S

SrA Michael Roszkowski USAF

I have a simple form that displays the data of a simple
table one record at a time.

I want to keep the form as simple as possible so I've
disabled all the "extras" that surround the normal Access
form such as the scroll bars and the record navigation
buttons.

To advance from one record to the other and from the first
record to the last I've used the command buttons.

What I want to do is have the "next" and "last"
buttons "greyed out" when you're at the first or last
record returned by the query running the form.

How the heck do you find out which record you're on? How
do you figure out what the last record is?

I figure the code would be in the "Current" event.

I've spent all day on this and any help would be greatly
appreciated.
 
Take a look at this sample db by Stephen Lebans - it has a subform with
navigation buttons that you can put into the footer of your form. Even if
you choose not to use this code asis, you can look at the procedure which
enables/disables the buttons. Basically what it does is use the
recordsetclone, attempt to scroll forward a row - if you get the EOF
condition you are at the EOF and so the Next button is disabled. Starting
back at the current record, it also tries to move backwards - if BOF is true
then the current record is the first so the Previous button is disabled.

http://www.lebans.com/recnavbuttons.htm
 
You're welcome and yes, it is a fabulous resource. I use many of Stephen's
solutions in my projects.
 
Back
Top