I have a subform fsubGuardianhship that has on it textbox ckGuardProof with a two-line label that uses two label controls: a transparent control LblProofGd1 containing the words "Proof of Guardianship", and a second label LblProofGd2 that provides a background and the second line of text, "in file?"
I want the text to be dark red and want LblProofGd to blink ONLY when ckGuardProof is not checked (that is, = 0 which is to say, 'no' or 'false') AND a toggle button on the main form TogBHasGuard, is selected (that is, = -1 which is to say, 'yes' or 'true').
I have tried writing the code a gajillion different ways and can get one set of conditions to work (for example, the effects I want 'If ckGuardProof = -1 AND TogBHasGuard = -1'), but when I add other conditions nothing works right and/or I do not get the correct behavior when, say, the ckGuardProof box is unchecked (it should turn from green to red and start blinking if the TogBHasBuard is -1; not-blinking if TogBHasGuard is 0 or null).
Here's the most step-by-step version of code I've tried.
colors are represented as follows:
14013951 is the pink background color of LblProofGd2 (if the text in lblProofGd1 is changed to this color it appears to turn off because it's the same color as background)
106 = dark red
18432 = dark green
First, for the blinking behavior, the On Timer property of the subform (in the fsubGuardianship module) is set as follows:
Private Sub Form_Timer()
With LblProofGd1
.ForeColor = (IIf(.ForeColor = 14013951, 106, 14013951))
End With
End Sub
Then in the AfterUpdate event of the checkbox ckGuardProof:
Private Sub ckGuardProof_AfterUpdate()
'This should cause 'Proof of Guardianship in File?' label to blink if
'main form Has-Guardian toggle is ON (yes) and subform 'Proof of
'Guardianship in File?' is NOT checked (false)
If Len(Trim(Nz(Me.ckGuardProof))) = 0 And Forms!frmClientInfoEnter.TogBHasGuard = -1 Then
Me.LblProofGd1.ForeColor = 14013951
Me.LblProofGd1.ForeColor = 106
Me.LblProofGd2.Caption = "in file?"
Me.TimerInterval = 500
End If
'When both subform 'Proof of Guardianship in file?' box is checked and main form 'Has
'Guardian' toggle is ON (yes), this should cause 'Proof in file?' label to turn dark
'green, remove the question mark from the label, and stop blinking behavior
If Me.ckGuardProof = -1 And Forms!frmClientInfoEnter.TogBHasGuard = -1 Then
Me.LblProofGd1.ForeColor = 18432
Me.LblProofGd2.ForeColor = 18432
Me.LblProofGd2.Caption = "in file"
Me.TimerInterval = 0
End If
'When both subform 'Proof of Guardianship in file?' box is NOT checked and main form
''Has Guardian' toggle NOT selected (false), this should TURN OFF blinking and
'cause 'Proof in file?' font to turn dark red as well as restore question mark.
If Len(Trim(Nz(Me.ckGuardProof))) = 0 And Len(Trim(Nz(Forms!frmClientInfoEnter.TogBHasGuard))) = 0 Then
Me.LblProofGd1.ForeColor = 106
Me.LblProofGd1.ForeColor = 106
Me.LblProofGd2.Caption = "in file?"
Me.TimerInterval = 0
End If
'If 'Proof of Guardianship in File?' box IS checked (yes) but 'Has Guardian' toggle on main
'form is NOT checked (false), makes subform label dark green, removes checkmark, and label
'stops blinking, but launches message box prompting user to change the 'Has Guardian' toggle
'to 'yes'.
If Me.ckGuardProof = -1 And Len(Trim(Nz(Forms!frmClientInfoEnter.TogBHasGuard))) = 0 Then
Me.LblProofGd1.ForeColor = 18432
Me.LblProofGd2.ForeColor = 18432
Me.LblProofGd2.Caption = "in file"
Me.TimerInterval = 0
myExclamation ("'Has Guardian' toggle button at right" & vbNewLine & _
"on main form Is not pressed." & vbNewLine & vbNewLine & _
"Please do so if there is Guardian.")
End If
If Forms!frmClientInfoEnter.TogBHasGuard = -1 And Me.ckGuardProof = -1 Then
End If
End Sub
Here's another way I've tried writing the If/Then statements:
If Len(Trim(Nz(Me.ckGuardProof))) = 0 And Forms!frmClientInfoEnter.TogBHasGuard = -1 Then
Me.LblProofGd1.ForeColor = 14013951
Me.LblProofGd1.ForeColor = 106
Me.LblProofGd2.Caption = "in file?"
Me.TimerInterval = 500
ElseIf Me.chGuardProof = -1 and Forms!frmClientInfoEnter.TogBHasGuard = -1 Then
Me.LblProofGd1.ForeColor = 18432
Me.LblProofGd2.ForeColor = 18432
Me.LblProofGd2.Caption = "in file"
Me.TimerInterval = 0
ElseIf Len(Trim(Nz(Me.ckGuardProof))) = 0 And Len(Trim(Nz(Forms!frmClientInfoEnter.TogBHasGuard))) = 0 Then
Me.LblProofGd1.ForeColor = 106
Me.LblProofGd1.ForeColor = 106
Me.LblProofGd2.Caption = "in file?"
Me.TimerInterval = 0
ElseIf Me.ckGuardProof = -1 Len(Trim(Nz(Forms!frmClientInfoEnter.TogBHasGuard))) = 0 Then
Me.LblProofGd1.ForeColor = 18432
Me.LblProofGd2.ForeColor = 18432
Me.LblProofGd2.Caption = "in file"
Me.TimerInterval = 0
myExclamation ("'Has Guardian' toggle button at right" & vbNewLine & _
"on main form Is not pressed." & vbNewLine & vbNewLine & _
"Please do so if there is Guardian.")
End If
Can anyone tell me what I'm doing wrong? I've spend days reworking code, & even trying other events....
C. Reyes
I want the text to be dark red and want LblProofGd to blink ONLY when ckGuardProof is not checked (that is, = 0 which is to say, 'no' or 'false') AND a toggle button on the main form TogBHasGuard, is selected (that is, = -1 which is to say, 'yes' or 'true').
I have tried writing the code a gajillion different ways and can get one set of conditions to work (for example, the effects I want 'If ckGuardProof = -1 AND TogBHasGuard = -1'), but when I add other conditions nothing works right and/or I do not get the correct behavior when, say, the ckGuardProof box is unchecked (it should turn from green to red and start blinking if the TogBHasBuard is -1; not-blinking if TogBHasGuard is 0 or null).
Here's the most step-by-step version of code I've tried.
colors are represented as follows:
14013951 is the pink background color of LblProofGd2 (if the text in lblProofGd1 is changed to this color it appears to turn off because it's the same color as background)
106 = dark red
18432 = dark green
First, for the blinking behavior, the On Timer property of the subform (in the fsubGuardianship module) is set as follows:
Private Sub Form_Timer()
With LblProofGd1
.ForeColor = (IIf(.ForeColor = 14013951, 106, 14013951))
End With
End Sub
Then in the AfterUpdate event of the checkbox ckGuardProof:
Private Sub ckGuardProof_AfterUpdate()
'This should cause 'Proof of Guardianship in File?' label to blink if
'main form Has-Guardian toggle is ON (yes) and subform 'Proof of
'Guardianship in File?' is NOT checked (false)
If Len(Trim(Nz(Me.ckGuardProof))) = 0 And Forms!frmClientInfoEnter.TogBHasGuard = -1 Then
Me.LblProofGd1.ForeColor = 14013951
Me.LblProofGd1.ForeColor = 106
Me.LblProofGd2.Caption = "in file?"
Me.TimerInterval = 500
End If
'When both subform 'Proof of Guardianship in file?' box is checked and main form 'Has
'Guardian' toggle is ON (yes), this should cause 'Proof in file?' label to turn dark
'green, remove the question mark from the label, and stop blinking behavior
If Me.ckGuardProof = -1 And Forms!frmClientInfoEnter.TogBHasGuard = -1 Then
Me.LblProofGd1.ForeColor = 18432
Me.LblProofGd2.ForeColor = 18432
Me.LblProofGd2.Caption = "in file"
Me.TimerInterval = 0
End If
'When both subform 'Proof of Guardianship in file?' box is NOT checked and main form
''Has Guardian' toggle NOT selected (false), this should TURN OFF blinking and
'cause 'Proof in file?' font to turn dark red as well as restore question mark.
If Len(Trim(Nz(Me.ckGuardProof))) = 0 And Len(Trim(Nz(Forms!frmClientInfoEnter.TogBHasGuard))) = 0 Then
Me.LblProofGd1.ForeColor = 106
Me.LblProofGd1.ForeColor = 106
Me.LblProofGd2.Caption = "in file?"
Me.TimerInterval = 0
End If
'If 'Proof of Guardianship in File?' box IS checked (yes) but 'Has Guardian' toggle on main
'form is NOT checked (false), makes subform label dark green, removes checkmark, and label
'stops blinking, but launches message box prompting user to change the 'Has Guardian' toggle
'to 'yes'.
If Me.ckGuardProof = -1 And Len(Trim(Nz(Forms!frmClientInfoEnter.TogBHasGuard))) = 0 Then
Me.LblProofGd1.ForeColor = 18432
Me.LblProofGd2.ForeColor = 18432
Me.LblProofGd2.Caption = "in file"
Me.TimerInterval = 0
myExclamation ("'Has Guardian' toggle button at right" & vbNewLine & _
"on main form Is not pressed." & vbNewLine & vbNewLine & _
"Please do so if there is Guardian.")
End If
If Forms!frmClientInfoEnter.TogBHasGuard = -1 And Me.ckGuardProof = -1 Then
End If
End Sub
Here's another way I've tried writing the If/Then statements:
If Len(Trim(Nz(Me.ckGuardProof))) = 0 And Forms!frmClientInfoEnter.TogBHasGuard = -1 Then
Me.LblProofGd1.ForeColor = 14013951
Me.LblProofGd1.ForeColor = 106
Me.LblProofGd2.Caption = "in file?"
Me.TimerInterval = 500
ElseIf Me.chGuardProof = -1 and Forms!frmClientInfoEnter.TogBHasGuard = -1 Then
Me.LblProofGd1.ForeColor = 18432
Me.LblProofGd2.ForeColor = 18432
Me.LblProofGd2.Caption = "in file"
Me.TimerInterval = 0
ElseIf Len(Trim(Nz(Me.ckGuardProof))) = 0 And Len(Trim(Nz(Forms!frmClientInfoEnter.TogBHasGuard))) = 0 Then
Me.LblProofGd1.ForeColor = 106
Me.LblProofGd1.ForeColor = 106
Me.LblProofGd2.Caption = "in file?"
Me.TimerInterval = 0
ElseIf Me.ckGuardProof = -1 Len(Trim(Nz(Forms!frmClientInfoEnter.TogBHasGuard))) = 0 Then
Me.LblProofGd1.ForeColor = 18432
Me.LblProofGd2.ForeColor = 18432
Me.LblProofGd2.Caption = "in file"
Me.TimerInterval = 0
myExclamation ("'Has Guardian' toggle button at right" & vbNewLine & _
"on main form Is not pressed." & vbNewLine & vbNewLine & _
"Please do so if there is Guardian.")
End If
Can anyone tell me what I'm doing wrong? I've spend days reworking code, & even trying other events....
C. Reyes