I have created this Function which highlights the labels of selected Option buttons. It is invoked whenever one either clicks a different button (i.e. vehicle direction) and when the 'Current' Event is triggered.
Public Function Format_Direction_Display(Direction As Integer)
Dim Black As Long
Dim Red As Long
Red = RGB(235, 0, 0)
Black = RGB(0, 0, 0)
Select Case Direction
Case 1:
Forms![Accident Picker]![D1NorthLabel].ForeColor = Red
Forms![Accident Picker]![D1NorthLabel].FontBold = True
Case 2:
Forms![Accident Picker]![D1NorthEastLabel].ForeColor = Red
Forms![Accident Picker]![D1NorthEastLabel].FontBold = True
Case 3:
Forms![Accident Picker]![D1EastLabel].ForeColor = Red
Forms![Accident Picker]![D1EastLabel].FontBold = True
.... and so on through 9 possible cases (8 valid directions and one for 'unknown')
It works fine, but here's the thing. There can be up to three vehicles and each one has its own little direction selection Option Group. The 1's in the above code (D1...) stand for the vehicle number, so this code explicitly handles Vehicle 1. Is there a way to utilize a passed variable for the vehicle number to replace the 1's so that this same function can be called for all three vehicles, or will I have to replicate the code using 2's and 3's?
Thanks.