Hi - I have opened a recordset in the the load of my form...
Option Explicit
Public rs As New adodb.Recordset
I can do stuff with move next buttons etc on the form - it works very well..
I wrote a couple of modules - modCheckEOF and modCheckBOF - you can guess what they do? Here's modCheckBOF
Option Explicit
Public Function CheckBOF() As Boolean
rs.MovePrevious
If rs.BOF Then
CheckBOF = True
rs.MoveNext
Else
CheckBOF = False
rs.MoveNext
End If
End Function
OK so far... but in the original form I have this code...
If CheckBOF Then
'disable the previous button on the toolbar
Toolbar1.Buttons.Item(3).Enabled = False
End If
This crashes with a "variable not defined" because I guess that it's going to modCheckBOF and it can't find rs...
What do I need to do to get this working? Is it unreasonable to write little pockets of code that I call from forms? Any general advice about scoping objects would be greatly appreciated!!!
Thanks!