Stuart has attended:
Access Intermediate course
Access Advanced course
Access VBA course
Buttons on a form
Hi,
I have a form with a few buttons and whilst tabbing through them it's very difficult to see which button I'm on. Is there a way to highlight/change the colour of the button in the same way a button can change colour when hovering over it with the mouse?
RE: Buttons on a form
Hello Stuart,
Hope you enjoyed your Microsoft Access courses with Best STL.
Thank you for your question regarding changing the colour of a button when tabbing onto it.
The following code does this for a command button named cmdCloseForm2 containing text items as opposed to images. It works!
First select the command button and from the Event section of the Property sheet click the ... in the On Got Focus row and use the code below. You must amend the part 'cmdCloseForm2' to whatever you have named your button. Colour choices are also up to you.
Private Sub cmdCloseForm2_GotFocus()
cmdCloseForm2.FontSize = 9
cmdCloseForm2.FontBold = True
cmdCloseForm2.ForeColor = vbRed
cmdCloseForm2.BackColor = vbYellow
End Sub
Private Sub cmdCloseForm2_LostFocus()
cmdCloseForm2.FontSize = 10
cmdCloseForm2.FontBold = False
cmdCloseForm2.ForeColor = vbBlack
cmdCloseForm2.BackColor = vbWhite
End Sub
Access will automatically place the second bit of code into the Lost Focus row in the Property sheet.
Give this a test and let me know how it works for you.
I hope this resolves your question. If it has, please mark this question as resolved.
If you require further assistance, please reply to this post. Or perhaps you have another Microsoft Office question?
Have a great day.
Regards,
Rodney
Microsoft Office Specialist Trainer