buttons form

Forum home » Delegate support and help forum » Microsoft Access Training and help » Buttons on a form

Buttons on a form

resolvedResolved · Low Priority · Version 2010

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?

Edited on Tue 16 Jul 2013, 11:42

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

RE: Buttons on a form

Rodney to the rescue again!

Thanks again for your time and expertise!

Stuart


 

Access tip:

Design View in Relationship window

Your in the Relationship window and changes are required to be made to a Table's design.

Rather than exiting the Relationship window, if you perform a right-mouse click on the table, it opens that table up in Design view

View all Access hints and tips


Server loaded in 0.11 secs.