I know this one has been answered before

  • Thread starter Thread starter Fay Yocum
  • Start date Start date
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
 
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.
 
Back
Top