spokaneneon
New member
- Local time
- Today, 11:34
- Joined
- Oct 7, 2011
- Messages
- 8
Hey guys! I have been using this site for awhile now and what a huge reference you have all been! Here is my coding dilemma.
I have a form that basically serves as a record browser. This form has control sources linked to the main table. IE: Tech Name, User ID, Pass, Fail ect...
What I want to do is when browsing the form, it loads the values fine into my buttons, and shows them as enabled, however, all I want to do is have the buttons be color coded based on Pass or Fail. Basically, if Pass is TRUE in my table, I want the button to be colored green, if Fail is TRUE I want the Fail button to be colored Red. The default value of grey or whatever is fine if it is not true/selected.
I have tried a few different lines of code, however when switching through records, it does not change colors accordingly. Here is what I have tried in my Form Load:
Private Sub Form_Load()
If Me.Toggle270 = True Then
Me.Toggle270.ForeColor = vbGreen
Else
Me.Toggle270.ForeColor = vbBlack
End If
End Sub
and have tried:
Private Sub Toggle270_AfterUpdate()
If Me.Toggle270 = True Then
Me.Toggle270.ForeColor = vbGreen
Else
Me.Toggle270.ForeColor = vbBlack
End If
End Sub
Private Sub Toggle270_BeforeUpdate(Cancel As Integer)
If Me.Toggle270 = True Then
Me.Toggle270.ForeColor = vbGreen
Else
Me.Toggle270.ForeColor = vbBlack
End If
End Sub
even in my before and after updates. For now, Pass is labed as Toggle270 and fail is labeled Toggle271.
Any ideas? Thanks for you're help!
I have a form that basically serves as a record browser. This form has control sources linked to the main table. IE: Tech Name, User ID, Pass, Fail ect...
What I want to do is when browsing the form, it loads the values fine into my buttons, and shows them as enabled, however, all I want to do is have the buttons be color coded based on Pass or Fail. Basically, if Pass is TRUE in my table, I want the button to be colored green, if Fail is TRUE I want the Fail button to be colored Red. The default value of grey or whatever is fine if it is not true/selected.
I have tried a few different lines of code, however when switching through records, it does not change colors accordingly. Here is what I have tried in my Form Load:
Private Sub Form_Load()
If Me.Toggle270 = True Then
Me.Toggle270.ForeColor = vbGreen
Else
Me.Toggle270.ForeColor = vbBlack
End If
End Sub
and have tried:
Private Sub Toggle270_AfterUpdate()
If Me.Toggle270 = True Then
Me.Toggle270.ForeColor = vbGreen
Else
Me.Toggle270.ForeColor = vbBlack
End If
End Sub
Private Sub Toggle270_BeforeUpdate(Cancel As Integer)
If Me.Toggle270 = True Then
Me.Toggle270.ForeColor = vbGreen
Else
Me.Toggle270.ForeColor = vbBlack
End If
End Sub
even in my before and after updates. For now, Pass is labed as Toggle270 and fail is labeled Toggle271.
Any ideas? Thanks for you're help!