How to call a procedure in a Module

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello,

I need the same procedure for 8 fields in a certain form. I have written the procedure in a module. Let's say in module 'modProcedures' and the procedure is called 'procedure1'.
The procedure starts with: Public Sub procedure1 () and ends with End Sub.

How can I create an event (double click event) that calls this procedure? Can someone give me an example of the code I need?

The procedure works, because I copied and pasted it to the double_click event of each field and it worked. But the procedure consists of 35 lines, so it is stupid to keep 8x35 lines. If I have to change one line, I need to do this 8 times, and I want to prevent that.

Can you please reply both here and to (e-mail address removed)? I am not able to check this forum every day.

Regards,
Bas van Heek
 
You can call procedure1 like this:
Call procedure1

If you have an event procedure set up on the double-click event of a control
named "Text1", it will look like this:
Private Sub Text1_DblClick(Cancel As Integer)
and you can call it in the same module with:
Call Text1_DblClick(False)

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Bas van Heek said:
I need the same procedure for 8 fields in a certain form. I have written
the procedure in a module. Let's say in module 'modProcedures' and the
procedure is called 'procedure1'.
The procedure starts with: Public Sub procedure1 () and ends with End Sub.

How can I create an event (double click event) that calls this procedure?
Can someone give me an example of the code I need?
The procedure works, because I copied and pasted it to the double_click
event of each field and it worked. But the procedure consists of 35 lines,
so it is stupid to keep 8x35 lines. If I have to change one line, I need to
do this 8 times, and I want to prevent that.
 
Back
Top