Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to Call a Procedure in a Module

Status
Not open for further replies.

5tr0ud

Programmer
Aug 9, 2004
29
US

I developed coding behind a button on a Subform. When clicked, it would update the Subform and the Main Form. But it would not let me save the change in the Main Form.

So I put the code in a Module and slightly modified it. It compiles OK. What code do I use to CALL THE PROCEDURE when the user clicks a button on the Subform. Here's my code, behind the "OnClick" button.

Private Sub cmdRetentionUpdateModule_Click()
RetentionUpdate
End Sub

I get this Compile error: "Expected variable or procedure, not module." Help!
 
Simply rename either the Sub or the Module as they can't have the same name.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Don't quite understand. My module is named RetentionUpdate. The code behind the button on the form is:
Private Sub cmdRetentionUpdateModule_Click()
RetentionUpdate
End Sub

Can you further explain?
I also looked at one of your suggested links . . . FAQ222-2244 in the MSDN Library re. procedures. Thank you for this link! (I didn't see something there I could try, although I've only created one other Module.) More help, if you can!
 
My module is named RetentionUpdate
How have you named the Sub that compiles OK ?
This is this Sub you have to call in your Click event procedure, not the module.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Dear PHV . . . I spoke too soon . . . and realized what you meant. My module had the same name as the subprocedure it contained. So I changed one of the names, compiled, re-ran the program, and SUCCESS. THANK YOU!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top