473,394 Members | 1,781 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Change a label's font color or background color with a mousemove event

46
Hi,

I am using Access 2007. I have a form in my database that I would like to have the font color or background color of some labels change when the cursor moves over them. Can anyone tell me how to do this?

thanks,
Jeff
Jun 23 '08 #1
4 19017
ADezii
8,834 Expert 8TB
Labels do not respond to Events (they have none), so the only way to implement what you are requesting is to write code for the MouseMove() Events of the Text Boxes to which they are associated, and then to Reset the Fore Colors in the MouseMove() Event of the Detail Section of the Form, as in:

When the Mouse Pointer passes over the Company and Contact Name Fields, the Fore Color of the associated Labels turn Green but as soon as the Pointer moves anywhere within the Detail Section, their Fore Colors revert to Blue. I know this isn't exactly what you were looking for, but it is just a suggestion.
Expand|Select|Wrap|Line Numbers
  1. Private Sub CompanyName_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
  2.  Me![CompanyNameLabel].ForeColor = vbGreen
  3. End Sub
Expand|Select|Wrap|Line Numbers
  1. Private Sub ContactName_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
  2.   Me![ContactNameLabel].ForeColor = vbGreen
  3. End Sub
Expand|Select|Wrap|Line Numbers
  1. Private Sub Detail_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
  2.   Me![CompanyNameLabel].ForeColor = vbBlue
  3.   Me![ContactNameLabel].ForeColor = vbBlue
  4. End Sub
Jun 24 '08 #2
jmar93
46
This was exactly the info I needed, it solved my problem.

Thank you very much.

Jeff
Jun 24 '08 #3
missinglinq
3,532 Expert 2GB
Actually, that's true of labels that are associated with textboxes (as most are in 2007) but independent labels do have a MouseMove event, as well as a few others.

Linq ;0)>
Jun 24 '08 #4
ADezii
8,834 Expert 8TB
Actually, that's true of labels that are associated with textboxes (as most are in 2007) but independent labels do have a MouseMove event, as well as a few others.

Linq ;0)>
Good point Linq, and definitely one worth mentioning.
Jun 24 '08 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: RWD | last post by:
I am trying to figure out how to change the target frame in my hyperlink on a DHTML menu. The menu is in one frame and the target frame is called "main" The code is below: Thanks in advance...
3
by: Steve Long | last post by:
I hope this isn't too stupid of a question but I'm looking for a way to change an item in a listview control when the mouse moves over it. I'd like to change its color and underline it for a...
2
by: Joe Delphi | last post by:
Hi, I want to position label text so that it always appears centered when the user re-sizes the browser window. I tried adding the HTML property text-align="CENTER" to the code, but ASP.NET...
10
by: apparker | last post by:
I'm creating a new GUI for a program and it is for a medical exam. There are so many different things to ask someone during a history it wastes too much space to make checkboxes for everything so I...
3
by: rn5a | last post by:
How do I change the BorderColor of the rows under the 2nd column in a DetailsView? I could change the BorderColor of the 1st column using the FieldHeaderStyle-BorderColor property but using...
1
by: cnixuser | last post by:
Hello, I am having a problem that I believe is related to the way a stream reader object looks for a text file by default. What I am doing is using a StreamReader object to read the text of a text...
0
by: Kevin McKinley | last post by:
Below i've put the code for a program that i wrote. I need help on lines 384-403. If you run this program you will notice on the first tab when have it produce an answer the $ is surrounded with...
0
by: Guilherme Polo | last post by:
On Wed, Sep 3, 2008 at 8:57 PM, Kevin McKinley <kem1723@yahoo.comwrote: Come on.. "help on lines 384-403", that is not a good way to look for help. You are supposed to post some minimal code that...
9
by: =?Utf-8?B?RnJhbmsgVXJheQ==?= | last post by:
Hi all I have a MDI Container Form, with one label control on the Background of this container form. When I now open a child form, this form is behind the label ... and this looks ugly ... :-))...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.