On Mouse Move Event Help.

Talismanic

Registered User.
Local time
Today, 22:23
Joined
May 25, 2000
Messages
377
I am trying to change the text of a button when the mouse pointer moves over it. Does anybody know of a way to do this with Access.

I would like to change it to magneta when the mouse is over it and back to black when it isn't. I just can't figure out how to capture the event and then let go of it.

If cmdOpenTimeSheetGR.OnMouseMove (I think I need something here) Then
cmdOpenTimeSheetGR.ForeColor = vbMagenta
Else
cmdOpenTimeSheetGR.ForeColor = vbBlack
End If

Any ideas?
 
I sent you a sample database that might help you...
 
Thanks, that did the trick.
 
Hi Tal & DT,

what was the solution? can you post the relevant code - there's many times i've wanted to use a 'mouseover' but the closest i've come is a hideous mousemove that flashes with every twitch...

many thanks

Drew
 
Sorry about that I was going to post it but opted not to for no good reason. There is actualy no "code" involved.

Put a control on a form with some text and then put this =fSetFontBoldRed("ButtonName") in the On Mouse Move Event, not in the code builder but right in the space that usualy says the macro name or a procedure.
 
I keep getting a function undefined error... Are you sure there isn't a the function fSetFontBoldRed("ButtonName") function sitting in a module in the DB?
 
Ok, I feel really stupid now, there is "code" behind the form. Did I just hear a great big duuuuhhhhhhh. I am sorry, my brain is not working this morning. By the way, this code was inside the form and not in an external module.

Option Compare Database
Option Explicit

'**************** Code Start *************
Dim mstPrevControlBlue As String
Dim mstPrevControlGreen As String
Dim mstPrevControlRed As String
Dim mstPrevControlBlack As String
Function fSetFontBoldBlue(stControlName As String)
On Error Resume Next
With Me(mstPrevControlBlue)
.ForeColor = 10485760
End With
mstPrevControlBlue = stControlName
With Me(stControlName)
.ForeColor = 16711680
End With
End Function
Function fSetFontBoldRed(stControlName As String)
On Error Resume Next
With Me(mstPrevControlRed)
.ForeColor = 255
End With
mstPrevControlRed = stControlName
With Me(stControlName)
.ForeColor = 8421631
End With
End Function
Function fSetFontBoldGreen(stControlName As String)
On Error Resume Next
With Me(mstPrevControlGreen)
.ForeColor = 32768
End With
mstPrevControlGreen = stControlName
With Me(stControlName)
.ForeColor = 65280
End With
End Function
Function fSetFontBoldBlack(stControlName As String)
On Error Resume Next
With Me(mstPrevControlBlack)
.ForeColor = 0
End With
mstPrevControlBlack = stControlName
With Me(stControlName)
.ForeColor = 8421504
End With
End Function
Function fRemoveFontBold()
On Error Resume Next
With Me(mstPrevControlBlue)
If .ForeColor = 16711680 Then .ForeColor = 10485760
End With
With Me(mstPrevControlGreen)
If .ForeColor = 65280 Then .ForeColor = 32768
End With
With Me(mstPrevControlRed)
If .ForeColor = 8421631 Then .ForeColor = 255
End With
With Me(mstPrevControlBlack)
If .ForeColor = 8421504 Then .ForeColor = 0
End With
End Function
'***************** Code End ****************


[This message has been edited by Talismanic (edited 06-07-2001).]
 
I am still missing something obvious here because when I try and put the code in my own form the color changes the first time I mouse over but does not change back like it does in the demo.

DT, what am I missing? And is ok to put your sample database on my website and provide a link here for others that might be interested in seeing it?
 
Tal,

You can use the sample database however you want...

Did you put the

=fRemoveFontBold()

in the OnMouseMove on the background of your form? I hope that makes sense.

DT

[This message has been edited by DT (edited 06-07-2001).]
 
ahhh, of course! I was missing the background bit too.

Thanks guys - my users will be most pleased
teufel.gif


[This message has been edited by KDg (edited 06-07-2001).]
 
Hello,

Am I doing something wrong? I extract the file and I can't open it, when I try to open it from Access it says I don't have the permissions needed.

Robert
 

Users who are viewing this thread

Back
Top Bottom