I have multiple forms that have navigation keys on them that perform the same function: Move first record, previous, next, and last. Only one form can be open at a time. I want to make the buttons on these forms access the same VB code.
What happens is one the button is pressed move to the correct record and then I have code to populate the forms controls.
What I have so far is a common sub that is want each key to go though, then bassed off which button was press then call the global codeing in a seperate module.
Code in form is:
Code in a separate module handles the checking for BOF, EOF, and such and makes the move to the recordset accordingly.
Whenever I try to attach this code to the buttons on the forms I get a message that the function name "cmdButton" cannot be found.
Any thought on how to get around this. I will be having about 10 forms that will have this same type of navigation added to then and do not want to dup the code on all of then if possible. This will prevent missing a form if the code needs to change for one of these buttons.
Thanks in advance.
Kyle Kittinger
What happens is one the button is pressed move to the correct record and then I have code to populate the forms controls.
What I have so far is a common sub that is want each key to go though, then bassed off which button was press then call the global codeing in a seperate module.
Code in form is:
Code:
Private Sub cmdButton()
If Me.cmdMoveFirst Then
Call glbMoveFirst
Else
If Me.cmdMoveLast Then
Call glbMoveLast
End If
else
if Me.cmdMoveNext then
....
....
....
End If
pPopulateFields ' populate control fields.
End Sub
Code in a separate module handles the checking for BOF, EOF, and such and makes the move to the recordset accordingly.
Whenever I try to attach this code to the buttons on the forms I get a message that the function name "cmdButton" cannot be found.
Any thought on how to get around this. I will be having about 10 forms that will have this same type of navigation added to then and do not want to dup the code on all of then if possible. This will prevent missing a form if the code needs to change for one of these buttons.
Thanks in advance.
Kyle Kittinger