Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 302
  • Last Modified:

Code for a module used on multiple forms

I have many forms that when they open all use the same code.  Is there a way to have each form look at a module for the code.  This would help in allowing me one place to make changes and not every form that needs it.  (I am using Access 2007.)

If this doesn't make sense let me know and I will try to explain more in depth.

V/r
John
0
John Sheehy
Asked:
John Sheehy
  • 2
2 Solutions
 
NorieVBA ExpertCommented:
John

Yes, just put the code in a standard module and call it from the whatever event, eg Open, you are currently running it from.
0
 
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database ArchitectCommented:
Expanding ...
After you create your Function (not a Sub) in a Standard Module, you can, if you like ... call it directly from the Property Sheet of a Control or Form - see image. And you can select multiple controls at once ... and paste in your Function name (with the equals sign) ...

fx
0
 
John SheehySecurity AnalystAuthor Commented:
You guys are genius'.  I appreciate the help.  I wasn't sure if it would work thay way and before I started changing things I wanted to be sure.  Thanks agian.

John
0
 
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database ArchitectCommented:
And of course, besides the Property sheet 'call', you can do it an VBA code anywhere:


' some code

Call mMySpecialFunction()

' more code

mx
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get 10% Off Your First Squarespace Website

Ready to showcase your work, publish content or promote your business online? With Squarespace’s award-winning templates and 24/7 customer service, getting started is simple. Head to Squarespace.com and use offer code ‘EXPERTS’ to get 10% off your first purchase.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now