when I use this code, the navigation buttons get disabled, but if I try to Debug, it gets really confusing...I get mixed results...using "F5" and "F8"...sometimes it disables the "next" and other times it doesn't.
all I'm trying to do is eliminate the message saying you can't go to the specified record.
http://www.access-programmers.co.uk/forums/showthread.php?s=&threadid=44199
Edit:
I threw this in, and it tricks the code, but will probably fail if there is only one record
Private Sub Form_Open(Cancel As Integer)
Me.Recordset.MoveNext
End Sub
all I'm trying to do is eliminate the message saying you can't go to the specified record.
http://www.access-programmers.co.uk/forums/showthread.php?s=&threadid=44199
Code:
Private Sub Form_Current()
'Command12 = cmdPrev
'Command11 = cmdNext
'Disable navigation buttons on end and beginning
If Me.RecordsetClone.RecordCount = 1 Then 'There is only one record
'cmdfirst.Enabled = False
'cmdlast.Enabled = False
Command12.Enabled = False
Command11.Enabled = False
ElseIf Me.RecordsetClone.RecordCount = Me.CurrentRecord Then 'You're at the last record
Command12.Enabled = True
Command11.Enabled = False
'cmdlast.Enabled = False
'cmdfirst.Enabled = True
ElseIf Me.CurrentRecord = 1 Then 'You're at the first record
Command12.Enabled = False
'cmdfirst.Enabled = False
Command11.Enabled = True
'cmdlast.Enabled = True
Else 'Your somewhere in between
Command12.Enabled = True
Command11.Enabled = True
'cmdfirst.Enabled = True
'cmdlast.Enabled = True
End If
End Sub
Edit:
I threw this in, and it tricks the code, but will probably fail if there is only one record
Private Sub Form_Open(Cancel As Integer)
Me.Recordset.MoveNext
End Sub
Last edited: