Customize navigation toolbar?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

My user does not want the 'next' button on the navigation toolbar to position
on a new record. Is there a way to gray out this button when I'm positioned
on the last record?

Thanks for any help.
 
I believe setting Allow Additions to NO will achieve your desired results.
 
thats not what I want as that will prohibit adding a new record by pressing
the new record button. I only want to prevent it when they press the 'next'
button.
 
Here is a procedure I use that is called by all my forms that have custom nav
buttons. The trick here is consistent naming conventions. It enables and
disables the buttons based on the location of the form's current record in
the recordset;

Sub SetNavButtons(ByRef frmSomeForm As Form)

On Error GoTo SetNavButtons_Error

With frmSomeForm
If .CurrentRecord = 1 Then
.cmdNextRec.Enabled = True
.cmdLastRec.Enabled = True
.cmdNextRec.SetFocus
.cmdFirstRec.Enabled = False
.cmdPreviousRec.Enabled = False
ElseIf .CurrentRecord = .Recordset.RecordCount Then
.cmdFirstRec.Enabled = True
.cmdPreviousRec.Enabled = True
.cmdPreviousRec.SetFocus
.cmdNextRec.Enabled = False
.cmdLastRec.Enabled = False
Else
.cmdFirstRec.Enabled = True
.cmdPreviousRec.Enabled = True
.cmdNextRec.Enabled = True
.cmdLastRec.Enabled = True
End If
End With

SetNavButtons_Exit:

On Error Resume Next
Exit Sub

SetNavButtons_Error:

MsgBox "Error " & Err.Number & " (" & Err.Description & _
") in procedure SetNavButtons of Module modFormOperations"
GoTo SetNavButtons_Exit

End Sub
 
Back
Top