Free Lessons
Courses
Seminars
TechHelp
Fast Tips
Templates
Topic Index
Forum
ABCD
 
Home   Courses   TechHelp   Forums   Help   Contact   Merch   Join   Order   Logon  
 
Back to Access Developer Forum    Comments List
Upload Images   @Reply   Bookmark    Link   Email   Next Unseen 
Global Modules
Richard Van Wagoner 
      
2 years ago
I have a code that I use on different forms to change the detail color. I would like to create a global modules to do this with one code. I have watched the video on creating a global module in Access Developer 5 Lesson 4. But it doesn't seem to answer my question. I will include some screenshot to show what I have.
Richard Van Wagoner OP  @Reply  
      
2 years ago

Richard Van Wagoner OP  @Reply  
      
2 years ago

Richard Van Wagoner OP  @Reply  
      
2 years ago

Richard Van Wagoner OP  @Reply  
      
2 years ago

Richard Van Wagoner OP  @Reply  
      
2 years ago
The first screenshot is what I have now on multiple forms. The second screenshot is the global module I created. The third is the error I get when running this module. And the last is how I inserted the module command in my form event.
Adam Schwanz  @Reply  
           
2 years ago
Yea you can't just use "me". It doesn't know what me is. Your going to have to send a form name to the sub as well as a parameter and then use that to set the colors.

Unless you have a "Male" field on every one of these forms that you use this on, you can't use that either and would need to provide a parameter for that too.

So you would need to do like
Public Sub MySub(MyForm As Form)
MyForm.Detail


Then you would need to call it with something like
MySub(Me.Name)
Richard Van Wagoner OP  @Reply  
      
2 years ago
So can you explain this a little more? Do I have to make a module for each form? Only changing the form name in each module? Also I have male field on each of the forms I am using this on. I sorry it is not making sense to me.
Richard Rost  @Reply  
          
2 years ago
Richard, sit tight. I've got a video on ActiveForm coming out. You can use that. Hang in there for a bit...
Kevin Robertson  @Reply  
          
2 years ago

Sami Shamma  @Reply  
             
2 years ago
The Global function does not know what "ME" refers to. Me only works when you are in the form or report itself.
you need to do one of two things:
1) send the form to the Global function as an argument
2) give the full name of the form as in (Forms!MyFormF!MyField.BackColor)
Sami Shamma  @Reply  
             
2 years ago
I was too slow again. lol
Richard Rost  @Reply  
          
2 years ago
And of course, ActiveForm doesn't work with this situation. I'll explain why in the video... but yes, the guys are right... passing the form to the global function works well. Video coming up...
Kevin Robertson  @Reply  
          
2 years ago
I tried ActiveForm first and the Main Menu changed colour instead. LOL.
Richard Rost  @Reply  
          
2 years ago
Richard start with this: Passing a Form
Richard Van Wagoner OP  @Reply  
      
2 years ago
This video works great except with my last ElseIf Statement. I changed ELSEIF ISNULL F ("Male) Then to ELSEIF F("Male")<>0 OR -1 THEN and it works. When I ran Compile I got an expected Then Error. But Thanks For all the Help guys!

This thread is now CLOSED. If you wish to comment, start a NEW discussion in Access Developer Forum.
 

Next Unseen

 
New Feature: Comment Live View
 
 

The following is a paid advertisement
Computer Learning Zone is not responsible for any content shown or offers made by these ads.
 

Learn
 
Access - index
Excel - index
Word - index
Windows - index
PowerPoint - index
Photoshop - index
Visual Basic - index
ASP - index
Seminars
More...
Customers
 
Login
My Account
My Courses
Lost Password
Memberships
Student Databases
Change Email
Info
 
Latest News
New Releases
User Forums
Topic Glossary
Tips & Tricks
Search The Site
Code Vault
Collapse Menus
Help
 
Customer Support
Web Site Tour
FAQs
TechHelp
Consulting Services
About
 
Background
Testimonials
Jobs
Affiliate Program
Richard Rost
Free Lessons
Mailing List
PCResale.NET
Order
 
Video Tutorials
Handbooks
Memberships
Learning Connection
Idiot's Guide to Excel
Volume Discounts
Payment Info
Shipping
Terms of Sale
Contact
 
Contact Info
Support Policy
Mailing Address
Phone Number
Fax Number
Course Survey
Email Richard
[email protected]
Blog RSS Feed    YouTube Channel

LinkedIn
Copyright 2026 by Computer Learning Zone, Amicron, and Richard Rost. All Rights Reserved. Current Time: 5/6/2026 12:06:38 PM. PLT: 1s