Solved

Change Label color in module without passing any arguments

Posted on 2013-10-27
2
371 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

Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

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

Today's users almost expect this to happen in all search boxes. After all, if their favourite search engine juggles with tens of thousand keywords while they type, and suggests matching phrases on the fly, why shouldn't they expect the same from you…
Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

895 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

16 Experts available now in Live!

Get 1:1 Help Now