Multiple command buttons

Gmoz

Registered User.
Local time
Today, 20:26
Joined
Jun 10, 2001
Messages
34
Was woundering if the was a way to habdle multiple command buttons with one procedure. I have done a little VB.Net and I remember that you coud use one sub to handle multiple buttons using the handles key word. I was wondering if Access could do that. What I have is 37 command buttons named cmdView1 through cmdView37 all I really need is the number that prefixes the command buttons name. I know how to pull out the number but I can not figure out how to use only one sub procedure for all 37 buttons. Any help is appreciated.

Frank
 
try this.......

Code:
Function UseForAllButtons ()
'put your code here to get button number
'you may need to define a button variable i.e. dim ctl as control
'ctl.controltype = acCommandButton
End Sub

Private Sub CmdButton1_Click()
Call UseForAllButtons
End Sub
Private Sub CmdButton2_Click()
Call UseForAllButtons
End Sub
Private Sub CmdButton3_Click()
Call UseForAllButtons
End Sub
Private Sub CmdButton4_Click()
Call UseForAllButtons
End Sub
'.................. 'and so forth
'..................
 
I appreciate the post but that is exactly what I was trying to get around. I did not really want 31 on click procedures.

Frank
 

Users who are viewing this thread

Back
Top Bottom