Is there a way in access to run the same onclick event from multiple buttons (without copying and pasting the code for each new button)
Something like
private sub btn1,btn2,btn3 on_click()
Do stuff
end sub
Is there a way in access to run the same onclick event from multiple buttons (without copying and pasting the code for each new button)
Something like
private sub btn1,btn2,btn3 on_click()
Do stuff
end sub
two ways
1. create a separate private sub in your form module e.g.
private sub btnclickevent()
,your code here
end sub
then for each button, call the btnclickevent
private sub btn1_click()
btnclickevent btn1
end sub
2. create a separate public module e.g.
public sub btnclickevent()
,your code here
end sub
then for each button properties, on the events tab, put
=btnclickevent()
where you would normally see [Event Procedure]
which method is right for you depends on what the code does. If it is something that only relates to the current form, use method 1, if something to be used across a number of forms, use the second method
Thx Ajax
Sent from my iPhone using Tapatalk