Solved

Code for a module used on multiple forms

Posted on 2012-04-08
4
284 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 34

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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
vb.net dbnull syntax 1 58
Looking for advice on how to develop a project database 2 48
MS Access query 16 61
Why Won't My Excel Workbook Refresh The Data 2 47
In earlier versions of Windows (XP and before), you could drag a database to the taskbar, where it would appear as a taskbar icon to open that database.  This article shows how to recreate this functionality in Windows 7 through 10.
Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

739 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