Calling a sub(in a module) from an Acess Form

abhiutd

Registered User.
Local time
Today, 05:11
Joined
Jul 28, 2008
Messages
48
Hi guys,
I have a very basic question. I placed a sub in the module and want to call it from one of my forms on button click event. So for eg
Module1 has this code
Sub SendEmail()

Form1 has this:
Private Sub Command23_Click()

' how do i call SendEmail from here...

End Sub


Thank You for your help.
 
Hi,

Create a Macro and assign your code module to the marco, then assign the marco to your on click event of your button.

John
 
Hi,

Create a Macro and assign your code module to the marco, then assign the marco to your on click event of your button.

John


Thank you for your resposne but isn't there some direct way to just calling the Sub if the module is in the same database. The reason why i say is because i have a second module in the same db with a function which is being called from a form simply like
Dim strFilter As String
strFilter = FunctionInModule(string t)

When i try to to the same for my other module it doesn't seem to work. What am i missing? I'm totally confused.

Thank You.
 
HI,

There most likely is a more direct way, but unfortunately, my knowledge doesn't extend that far yet. I use this method alot and it works fine for me, never had any problems with it.

Sorry I couldn't be of more help.

John
 
HI,

There most likely is a more direct way, but unfortunately, my knowledge doesn't extend that far yet. I use this method alot and it works fine for me, never had any problems with it.

Sorry I couldn't be of more help.

John

For now i'm trying to go with your approach but i have few questions. When i create macro it creates a new module with a Sub called my macro name. How do i assign the macro to my click event method?

Thank You.
 

Users who are viewing this thread

Back
Top Bottom