Hello,
I'm trying to make navigation buttons by myself (For a better UI design). Normally if I do accept new records in a form, I can still go to next record (which is a new record) by click next button while the form showing the last record.
But I still want to add new records, and stop next record button from go to a new record by disable it.
Here is my code,
It works well, except when I open this form. Problem is when I open the form (which shows 1st record by default), next button is already disabled, and previous button is still enable.Private Sub Form_Current()
Dim rs As Object
Set rs = Me.Recordset
'If is the last
If rs.AbsolutePosition = rs.RecordCount - 1 Then
'Disable New
Me.Next.Enabled = False
'Enable Previous
Me.Previous.Enabled = True
ElseIf rs.AbsolutePosition = 0 Then
Me.Previous.Enabled = False
Me.Next.Enabled = True
Else
Me.Next.Enabled = True
Me.Previous.Enabled = True
End If
End Sub
' Next & Previous are navigation buttons I made by button wizard
But after select another record by a combobox I made, both button works well, they do disable and enable at the right time.
Which I guess there's some problem in Recordset, but I don't know how to work it out.
I've tried to use EOF and BOF, it's not working, says something like recordset type not match (sorry but I'm not using English MS Access so I don't know what this error msg will be in English)
Would anyone give me some hints?
Thank you.