I know this one has been answered before

F

Fay Yocum

I am sorry about this but I have been trying to find the code to dim the
first button if at the start of the recordset and block the error message.
Can some one direct me to an article. Thanks Fay
 
B

Bruce

If by chance you are referring to record navigation
buttons you have added to the form, and if you mean you
would rather disable the buttons when you are at the first
or last record than have the standard error message "You
can't go to the specified record" appear, try the
following code in the form's On Current event:

cmdPrevious.Enabled = Not Me.CurrentRecord = 1
cmdNext.Enabled = (Me.CurrentRecord = 1 And _
Me.Recordset.RecordCount > 1) Or _
Me.CurrentRecord < Me.Recordset.RecordCount

The code assumes that your navigation buttons are named
cmdPrevious and cmdNext, and that both are enabled on the
Property Sheet. Note that underscores in the above code
mean there is no line break. Just leave them out when you
enter the code.
 

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