G
Guest
I have several forms on which I would like to use custom nav buttons. I have
successfully set this up on one form but it seems like I should be able to
put the code in a module and call the procedure when the form opens (the
form's On Current event) and when the First, Previous... buttons are pressed
(On Click Event)
Here is my On Current code:
Private Sub Form_Current()
Dim rsClone As Recordset
Set rsClone = Me.RecordsetClone
If Me.NewRecord = True Then
Me!cmdAdd.Enabled = False
Me!cmdNext.Enabled = False
Me!cmdPrevious.Enabled = True
Me!cmdFirst.Enabled = True
Me!cmdLast.Enabled = True
ElseIf rsClone.Bookmarkable = True Then
Me!cmdAdd.Enabled = True
rsClone.Bookmark = Me.Bookmark
rsClone.MovePrevious
cmdFirst.Enabled = Not (rsClone.BOF)
cmdPrevious.Enabled = Not (rsClone.BOF)
rsClone.MoveNext
rsClone.MoveNext
cmdNext.Enabled = Not (rsClone.EOF)
cmdLast.Enabled = Not (rsClone.EOF)
rsClone.MovePrevious
End If
rsClone.Close
End Sub
Here is the On Click event code for the First button:
Private Sub cmdFirst_Click()
DoCmd.GoToRecord , , acFirst
End Sub
I created a new module called "Nav" and changed "Private" to Public and then
tried to call the procedure but there is a problem with using "Me." Looks
like I need to use another technique and I've never called a procedure so I
could use a suggestion there as well.
Thanks for any help you can offer.
successfully set this up on one form but it seems like I should be able to
put the code in a module and call the procedure when the form opens (the
form's On Current event) and when the First, Previous... buttons are pressed
(On Click Event)
Here is my On Current code:
Private Sub Form_Current()
Dim rsClone As Recordset
Set rsClone = Me.RecordsetClone
If Me.NewRecord = True Then
Me!cmdAdd.Enabled = False
Me!cmdNext.Enabled = False
Me!cmdPrevious.Enabled = True
Me!cmdFirst.Enabled = True
Me!cmdLast.Enabled = True
ElseIf rsClone.Bookmarkable = True Then
Me!cmdAdd.Enabled = True
rsClone.Bookmark = Me.Bookmark
rsClone.MovePrevious
cmdFirst.Enabled = Not (rsClone.BOF)
cmdPrevious.Enabled = Not (rsClone.BOF)
rsClone.MoveNext
rsClone.MoveNext
cmdNext.Enabled = Not (rsClone.EOF)
cmdLast.Enabled = Not (rsClone.EOF)
rsClone.MovePrevious
End If
rsClone.Close
End Sub
Here is the On Click event code for the First button:
Private Sub cmdFirst_Click()
DoCmd.GoToRecord , , acFirst
End Sub
I created a new module called "Nav" and changed "Private" to Public and then
tried to call the procedure but there is a problem with using "Me." Looks
like I need to use another technique and I've never called a procedure so I
could use a suggestion there as well.
Thanks for any help you can offer.