P
Paul B.
I am having trouble with my code. When I open the form, and there is only one
record, only my Next and Last Nav Buttons are disabled, when all of them
should be.
Any help would be appreciated.
-------------
Private Sub Form_Load()
Dim rst As DAO.Recordset
Dim lngCount As Long
Set rst = Me.RecordsetClone
With rst
.MoveFirst
.MoveLast
lngCount = .RecordCount
End With
If Me.CurrentRecord = lngCount Then
Me.cmdLastRecord.Enabled = False
Me.cmdNextRecord.Enabled = False
Me.cmdPreviousRecord.Enabled = True
Me.cmdFirstRecord.Enabled = True
ElseIf Me.CurrentRecord = 1 Then
Me.cmdLastRecord.Enabled = True
Me.cmdNextRecord.Enabled = True
Me.cmdPreviousRecord.Enabled = False
Me.cmdFirstRecord.Enabled = False
Else
Me.cmdLastRecord.Enabled = True
Me.cmdNextRecord.Enabled = True
Me.cmdPreviousRecord.Enabled = True
Me.cmdFirstRecord.Enabled = True
End If
End Sub
---------------
record, only my Next and Last Nav Buttons are disabled, when all of them
should be.
Any help would be appreciated.
-------------
Private Sub Form_Load()
Dim rst As DAO.Recordset
Dim lngCount As Long
Set rst = Me.RecordsetClone
With rst
.MoveFirst
.MoveLast
lngCount = .RecordCount
End With
If Me.CurrentRecord = lngCount Then
Me.cmdLastRecord.Enabled = False
Me.cmdNextRecord.Enabled = False
Me.cmdPreviousRecord.Enabled = True
Me.cmdFirstRecord.Enabled = True
ElseIf Me.CurrentRecord = 1 Then
Me.cmdLastRecord.Enabled = True
Me.cmdNextRecord.Enabled = True
Me.cmdPreviousRecord.Enabled = False
Me.cmdFirstRecord.Enabled = False
Else
Me.cmdLastRecord.Enabled = True
Me.cmdNextRecord.Enabled = True
Me.cmdPreviousRecord.Enabled = True
Me.cmdFirstRecord.Enabled = True
End If
End Sub
---------------