I am using the following code to change numerous images/text/buttons on my home navigation screen from white to orange when they are highlighted and then returned to white when the mouse is moved back over the background that is behind/ separates the boxes.
I'm sure there was a cleaner way to do this but i am a novice when it comes to VBA.
My problem is that if i swipe my mouse fast enough between the text boxes i can make multiple of them change color, until i slowly move my mouse over the background. Is there a way to speed up this response time? or another method to my madness?
Code:
Private Sub ButMOC_Click()
Me.tabMOC.SetFocus
End Sub
Private Sub butPI_Click()
Me.TabPlantInfo.SetFocus
End Sub
Private Sub butPI_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
FontOrange = RGB(237, 125, 49)
If Not Me!arr1.ForeColor = FontOrange Then
Me!arr1.ForeColor = FontOrange
Me!cmdPI.ForeColor = FontOrange
Me!ImgPIOn.Visible = True
End If
End Sub
Private Sub butPM_Click()
Me.TabPM.SetFocus
End Sub
Private Sub butPM_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
FontOrange = RGB(237, 125, 49)
If Not Me!arr2.ForeColor = FontOrange Then
Me!arr2.ForeColor = FontOrange
Me!cmdPM.ForeColor = FontOrange
Me!ImgPMOn.Visible = True
End If
End Sub
Private Sub butPur_Click()
Me.TabPur.SetFocus
End Sub
Private Sub butWO_Click()
Me.TabWO.SetFocus
End Sub
Private Sub butWO_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
FontOrange = RGB(237, 125, 49)
If Not Me!arr3.ForeColor = FontOrange Then
Me!arr3.ForeColor = FontOrange
Me!cmdWO.ForeColor = FontOrange
Me!imgWOOn.Visible = True
End If
End Sub
Private Sub ButPro_Click()
Me.TabPro.SetFocus
End Sub
Private Sub ButAdm_Click()
Me.TabAdm.SetFocus
End Sub
Private Sub ButUpd_Click()
Me.Tabupd.SetFocus
End Sub
Private Sub butMOC_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
FontOrange = RGB(237, 125, 49)
If Not Me!arr4.ForeColor = FontOrange Then
Me!arr4.ForeColor = FontOrange
Me!cmdMOC.ForeColor = FontOrange
Me!imgMOCOn.Visible = True
End If
End Sub
Private Sub ButPUR_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
FontOrange = RGB(237, 125, 49)
If Not Me!arr5.ForeColor = FontOrange Then
Me!arr5.ForeColor = FontOrange
Me!cmdPur.ForeColor = FontOrange
Me!imgPurOn.Visible = True
End If
End Sub
Private Sub ButPro_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
FontOrange = RGB(237, 125, 49)
If Not Me!arr6.ForeColor = FontOrange Then
Me!arr6.ForeColor = FontOrange
Me!cmdPro.ForeColor = FontOrange
Me!ImgproOn.Visible = True
End If
End Sub
Private Sub ButAdm_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
FontOrange = RGB(237, 125, 49)
If Not Me!arr7.ForeColor = FontOrange Then
Me!arr7.ForeColor = FontOrange
Me!cmdAdm.ForeColor = FontOrange
Me!imgadmOn.Visible = True
End If
End Sub
Private Sub ButUpd_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
FontOrange = RGB(237, 125, 49)
If Not Me!arr8.ForeColor = FontOrange Then
Me!arr8.ForeColor = FontOrange
Me!cmdUpd.ForeColor = FontOrange
Me!imgUpdOn.Visible = True
End If
End Sub
Private Sub Box5_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
FontWhite = RGB(255, 255, 255)
If Not Me!arr1.ForeColor = FontWhite Then
Me!arr1.ForeColor = FontWhite
Me!cmdPI.ForeColor = FontWhite
Me!ImgPIOn.Visible = False
End If
If Not Me!arr2.ForeColor = FontWhite Then
Me!arr2.ForeColor = FontWhite
Me!cmdPM.ForeColor = FontWhite
Me!ImgPMOn.Visible = False
End If
If Not Me!arr3.ForeColor = FontWhite Then
Me!arr3.ForeColor = FontWhite
Me!cmdWO.ForeColor = FontWhite
Me!imgWOOn.Visible = False
End If
If Not Me!arr4.ForeColor = FontWhite Then
Me!arr4.ForeColor = FontWhite
Me!cmdMOC.ForeColor = FontWhite
Me!imgMOCOn.Visible = False
End If
If Not Me!arr5.ForeColor = FontWhite Then
Me!arr5.ForeColor = FontWhite
Me!cmdPur.ForeColor = FontWhite
Me!imgPurOn.Visible = False
End If
If Not Me!arr6.ForeColor = FontWhite Then
Me!arr6.ForeColor = FontWhite
Me!cmdPro.ForeColor = FontWhite
Me!ImgproOn.Visible = False
End If
If Not Me!arr7.ForeColor = FontWhite Then
Me!arr7.ForeColor = FontWhite
Me!cmdAdm.ForeColor = FontWhite
Me!imgadmOn.Visible = False
End If
If Not Me!arr8.ForeColor = FontWhite Then
Me!arr8.ForeColor = FontWhite
Me!cmdUpd.ForeColor = FontWhite
Me!imgUpdOn.Visible = False
End If
End Sub
Private Sub Command92_Click()
Me.TabPlantInfo.SetFocus
End Sub
Private Sub Command92_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
FontOrange = RGB(237, 125, 49)
If Not Me!arr1.ForeColor = FontOrange Then
Me!arr1.ForeColor = FontOrange
Me!ImgPIOn.Visible = True
Me!cmdPI.ForeColor = FontOrange
End If
End Sub
Private Sub Command95_Click()
End Sub
Private Sub Form_Load()
Me.Move 0, 0
End Sub
Private Sub Image67_Click()
'Me.TabHome.SetFocus
DoCmd.OpenForm "home screen"
End Sub
Private Sub MainTabctl_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
FontWhite = RGB(255, 255, 255)
If Not Me!arr1.ForeColor = FontWhite Then
Me!arr1.ForeColor = FontWhite
Me!cmdPI.ForeColor = FontWhite
Me!ImgPIOn.Visible = False
End If
If Not Me!arr2.ForeColor = FontWhite Then
Me!arr2.ForeColor = FontWhite
Me!cmdPM.ForeColor = FontWhite
Me!ImgPMOn.Visible = False
End If
If Not Me!arr3.ForeColor = FontWhite Then
Me!arr3.ForeColor = FontWhite
Me!cmdWO.ForeColor = FontWhite
Me!imgWOOn.Visible = False
End If
If Not Me!arr4.ForeColor = FontWhite Then
Me!arr4.ForeColor = FontWhite
Me!cmdMOC.ForeColor = FontWhite
Me!imgMOCOn.Visible = False
End If
If Not Me!arr5.ForeColor = FontWhite Then
Me!arr5.ForeColor = FontWhite
Me!cmdPur.ForeColor = FontWhite
Me!imgPurOn.Visible = False
End If
If Not Me!arr6.ForeColor = FontWhite Then
Me!arr6.ForeColor = FontWhite
Me!cmdPro.ForeColor = FontWhite
Me!ImgproOn.Visible = False
End If
If Not Me!arr7.ForeColor = FontWhite Then
Me!arr7.ForeColor = FontWhite
Me!cmdAdm.ForeColor = FontWhite
Me!imgadmOn.Visible = False
End If
If Not Me!arr8.ForeColor = FontWhite Then
Me!arr8.ForeColor = FontWhite
Me!cmdUpd.ForeColor = FontWhite
Me!imgUpdOn.Visible = False
End If
End Sub
I'm sure there was a cleaner way to do this but i am a novice when it comes to VBA.
My problem is that if i swipe my mouse fast enough between the text boxes i can make multiple of them change color, until i slowly move my mouse over the background. Is there a way to speed up this response time? or another method to my madness?