Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

Is there a way to “conditionally format” option groups containing toggle buttons on an MS Access form?

0
Posted

Is there a way to “conditionally format” option groups containing toggle buttons on an MS Access form?

0

Here’s a method for highlighting the Back Color of the option group based on the value of the button selected. You need to make sure that the property for Back Style is set to Normal (Transparent is the default). The method requires VBA to accomplish the highlighting. Using your example, I’ve set the option group name to: ‘grpBooked’. The option group selections are Yes, No, and N/A (values 1, 2, and 3 respectively). I’ve chosen the back color to be set to GREEN for ‘Yes’, RED for ‘No’ and YELLOW’ for ‘N/A’ (for lack of anything better – you can change to whatever you deem necessary). Here’s the VBA code to accomplish the highlighting, an additional call for the procedure FormatGroup is necessary whenever the data might get changed by any other method than the form loading or the option group being clicked. Code: Private Sub Form_Load() FormatGroup End Sub Private Sub grpBooked_Click() FormatGroup End Sub Sub FormatGroup() Select Case grpBooked Case 1 grpBooked.BackColor = vbGreen Case

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.

Experts123