I have a form on which I have 80 small boxes that represent panels on vehicles, and they are in fact located on graphic depictions of vehicles. We have two 40-character strings. Each character in the strings can be 0,1,2 or 3 representing the amount of damage to that panel. There are two strings because there are 40 possible locations on each of two vehicles.
So, when we go to a new record, I want to set the colors of each of the panels based on the value of the corresponding character in the string. So, for example, if the 10th character is "0" then the box on panel number 10 would be invisible, if it is "3" it would be red indicating heavy damage.
The little boxes are named DamageV1P1, DamageV1P2..... DamageV1P40, DamageV2P1..... DamageV2P39, DamageV21P40. So it's like a 2x40 array.
I have code in the 'Current' event that works fine for setting DamageV1P1. It is:
PanelValue = Mid(V1Damage, 1, 1) <----- V1Damage is the 40-char string described above, For 2nd vehicle it's V2Damage
If PanelValue = 0 Then Me.DamageV1P1.Visible = False Else Me.DamageV1P1.Visible = True
If PanelValue = 1 Then Me.DamageV1P1.BackColor = Green
If PanelValue = 2 Then Me.DamageV1P1.BackColor = YellowOrange
If PanelValue = 3 Then Me.DamageV1P1.BackColor = Red
I don't want to replicate the code for all 80 panels so what I want to do is place all 5 of these statements in a double loop (1 to 2 and 1 to 40) that increments the first variable in the MID statement (no problem) and the object names (problem). Since these call out are not in quotes, I can't see how to do it like I would is, for example, this was happening inside something like Domain Aggregate call where you can close the quotes and append a variable. Everything I've tried has resulted in errors.
I appreciate any help you can offer.