M
max
Hi all,
may be it is easy but I'm not that good...
I have this code in the OnCurrent event of the form to disable the Previous
Button on the nav bar if the current record is the first in the recordset:
'----- start of code ---------------
If Me.Parent.RecordsetClone.RecordCount = 0 Then 'we need to check if there
are NO RECORDS. If so,
Me.cmdNext.Enabled = False 'we disable
all buttons except for the <New> button.
Me.cmdPrev.Enabled = False
Me.cmdLast.Enabled = False
Else
Me.Parent.RecordsetClone.Bookmark = Me.Parent.Bookmark 'Synchronise
the current pointer in the two recordsets
With Me.Parent.RecordsetClone
'If there are records, see if we are on the first record
.MovePrevious
'If so, we should disable the <First> and <Prev> buttons
If .BOF Then
Me.cmdHidden.SetFocus
Me.cmdPrev.Enabled = False
Exit Sub
End If
End With
End If
'----- end of code ---------------
the question:
how is it possible to add at the end of this procedure a similar feature to
disable the Next Button on the nav bar if the current record is the last in
the recordset? Or may be I have to write it in a different procedure?
Thanks a lot,
Max
may be it is easy but I'm not that good...
I have this code in the OnCurrent event of the form to disable the Previous
Button on the nav bar if the current record is the first in the recordset:
'----- start of code ---------------
If Me.Parent.RecordsetClone.RecordCount = 0 Then 'we need to check if there
are NO RECORDS. If so,
Me.cmdNext.Enabled = False 'we disable
all buttons except for the <New> button.
Me.cmdPrev.Enabled = False
Me.cmdLast.Enabled = False
Else
Me.Parent.RecordsetClone.Bookmark = Me.Parent.Bookmark 'Synchronise
the current pointer in the two recordsets
With Me.Parent.RecordsetClone
'If there are records, see if we are on the first record
.MovePrevious
'If so, we should disable the <First> and <Prev> buttons
If .BOF Then
Me.cmdHidden.SetFocus
Me.cmdPrev.Enabled = False
Exit Sub
End If
End With
End If
'----- end of code ---------------
the question:
how is it possible to add at the end of this procedure a similar feature to
disable the Next Button on the nav bar if the current record is the last in
the recordset? Or may be I have to write it in a different procedure?
Thanks a lot,
Max