Event procedure

  • Thread starter Thread starter binny
  • Start date Start date
B

binny

Please tell me if I can use the [event procedure] more than once in a form.
If I change the name. It doesn't work. If I don't change the name. The
[event procedure] just moves to from one combo box to the next. Is there
some way to save a procedure and rename it.
 
binny said:
Please tell me if I can use the [event procedure] more than once in a
form.
If I change the name. It doesn't work. If I don't change the name. The
[event procedure] just moves to from one combo box to the next. Is there
some way to save a procedure and rename it.


Maybe you mean something like this ...

Option Compare Database
Option Explicit

Private Sub SomeProcContainingCommonCode()

MsgBox "Common code goes here"

End Sub

Private Sub Form_Close()

SomeProcContainingCommonCode

End Sub

Private Sub Form_Open(Cancel As Integer)

SomeProcContainingCommonCode

End Sub
 
OOOO.KKKKK
So it looks like my next move is back to my online Uni to take a course
on VBA
Thanks anyway
--
binny


Brendan Reynolds said:
binny said:
Please tell me if I can use the [event procedure] more than once in a
form.
If I change the name. It doesn't work. If I don't change the name. The
[event procedure] just moves to from one combo box to the next. Is there
some way to save a procedure and rename it.


Maybe you mean something like this ...

Option Compare Database
Option Explicit

Private Sub SomeProcContainingCommonCode()

MsgBox "Common code goes here"

End Sub

Private Sub Form_Close()

SomeProcContainingCommonCode

End Sub

Private Sub Form_Open(Cancel As Integer)

SomeProcContainingCommonCode

End Sub
 
What are you trying to do with the Event Procedure? Remember that you can
not only have Event Procedures in forms, you can also have them individual
controls in the form.
You can also have Subs and Functions in Modules.
I don't know what you mean 'If I change the name' - remember, none of us can
see what you are doing and I for one, don't have a good enough memory or the
time or inclination to hunt through all your previous posts to see what you
wanted to do there. You say 'is there some way to save a procedure and
rename it'. Much more clarity is needed.

Evi
 
Back
Top