I have 28+ toggle buttons that when 'clicked' will change color and update an unbound field by adding 1, (if its value is "-1" else it will revert to the original color and update the unbound field by subtracting 1. Is there a way I can write this code once in a public area and use the call function from each control? I do not know how to pass the name of the control that is calling the function.
I am trying to avoid adding this code to each button. Any help would be great.
Private Sub Toggle27_Click()
Dim thecontrol As Control
thecontrol = "[Toggle27]"
Call schdpick
end sub
Private Sub schdpick()
Dim thecontrol as Control
If thecontrol = -1 Then
test = "On"
thecontrol.FontBold = True
thecontrol.ForeColor = 16744448
test.Requery
Else
test = "Off"
thecontrol.FontBold = False
thecontrol.ForeColor = -2147483630
test.Requery
End If
End Sub
I am trying to avoid adding this code to each button. Any help would be great.
Private Sub Toggle27_Click()
Dim thecontrol As Control
thecontrol = "[Toggle27]"
Call schdpick
end sub
Private Sub schdpick()
Dim thecontrol as Control
If thecontrol = -1 Then
test = "On"
thecontrol.FontBold = True
thecontrol.ForeColor = 16744448
test.Requery
Else
test = "Off"
thecontrol.FontBold = False
thecontrol.ForeColor = -2147483630
test.Requery
End If
End Sub