I have been trying to implement navigation buttons for a number of
forms in my application.
Creating the 'Next' 'Previous' buttons has been fine but setting the
enabled properties doesn't work due to problems with the BOF and EOF
properites. They never appear to be set properly.
Here is the offending code:
private sub Form_Current()
With Me.RecordsetClone
Me.CmdPrevious.Enabled = Not (.BOF)
Me.CmdPrevious.Enabled = Not (.EOF)
End With
end sub
command code:
Private Sub CmdNext_Click()
DoCmd.GoToRecord , , acNext
End Sub
Private Sub CmdPrevious_Click()
DoCmd.GoToRecord , , acPrevious
End Sub
I have stripped out the checks in the code that handle for new/no
record.
The the buttons are always enabled (set to true) by this code. When
the user clicks the Previous/Next button when the record position at
the begining/end of the set I get error 2105 which should not happen
if BOF/EOF is working properly.
I have tried other methods to determine whether the form is at the
first/last record using the absoluteposition or the bookmark
properties. No luck there. The code becomes much more complex as well.
Does anybody know something that might help. I must be doing something
fundermentally wrong here to cause this problem.
Thanks.