Solved

Code for a module used on multiple forms

Posted on 2012-04-08
4
271 Views
Last Modified: 2012-04-08
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
Comment
Question by:John Sheehy
  • 2
4 Comments
 
LVL 33

Assisted Solution

by:Norie
Norie earned 250 total points
ID: 37821783
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
 
LVL 75

Accepted Solution

by:
DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform) earned 250 total points
ID: 37821795
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
 

Author Comment

by:John Sheehy
ID: 37821874
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
 
LVL 75
ID: 37821893
And of course, besides the Property sheet 'call', you can do it an VBA code anywhere:


' some code

Call mMySpecialFunction()

' more code

mx
0

Featured Post

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question