Solved

Change Label color in module without passing any arguments

Posted on 2013-10-27
2
372 Views
Last Modified: 2013-10-27
Hi

Office 365 /  Access question

I have a form which calls a subroutine which is found in a module.  I am trying to adapt the following code work from a module so that I can call it from several forms.

 The call to this code will only come from the active form.   The name of the label "lblTest" will always be the the same so, I would prefer to not send the label as an argument.

Call Mod_Testme

Open in new window



Public Sub mod_testme()
    Dim TheForm As Form: Set TheForm = Screen.ActiveForm
    TheForm! lblTest.ForeColor = vbRed
End Sub

Open in new window

0
Comment
Question by:peispud
2 Comments
 
LVL 27

Accepted Solution

by:
MacroShadow earned 500 total points
ID: 39604417
The code you posted should work, (note: remove the extra space after "TheForm!").
0
 

Author Closing Comment

by:peispud
ID: 39604434
I overlooked the obvious!    I had tried other things but not this cause it seemed to easy.  It was. Thanks!
0

Featured Post

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

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

In the previous article, Using a Critera Form to Filter Records (http://www.experts-exchange.com/A_6069.html), the form was basically a data container storing user input, which queries and other database objects could read. The form had to remain op…
A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

813 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now