Hello,
In an Access 2003 ADP Subform, I am trying to set the BackGround color
of three textbox fields (LSScore, RScore, WScore) in the current
record of the subform to zero (black) if the value of a bound checkbox
field (Spanish) on the current record is True, and to 16777164 if the
value of the bound checkbox field is False.
The Subform's Name property is 'frmMainScores'. The Source Object
Property of the Subform is 'frmMainSubScores'. The Default View
property of the form 'frmMainSubScores' is set to Continuous Forms.
The following is the code that I have for the Form_Current of the
subform:
**************************************************
Private Sub Form_Current()
If (Forms!frmMain!frmMainScores.Form!Spanish = True) Then
Forms!frmMain!frmMainScores.Form!LSScore.BackColor = 0
Forms!frmMain!frmMainScores.Form!RScore.BackColor = 0
Forms!frmMain!frmMainScores.Form!WScore.BackColor = 0
ElseIf (Forms!frmMain!frmMainScores.Form!Spanish = False) Then
Forms!frmMain!frmMainScores.Form!LSScore.BackColor = 16777164
Forms!frmMain!frmMainScores.Form!RScore.BackColor = 16777164
Forms!frmMain!frmMainScores.Form!WScore.BackColor = 16777164
End If
End Sub
*************************************************
I am not getting the results that I expected with this code. If
'Spanish' in the first record of the subform = True, then the three
fields for every record have a background color of zero, regardless of
whether or not 'Spanish' = True.
The background color of these three fields changes the way I expect
the change to occur only if I click the subform record selector for
each record, but the the background color change occurs for every
record by the condition of 'Spanish' for the record that I click on.
In other words, If I click on the subform record selector of a record
where 'Spanish' is True, then the background color of the three fields
turns black for every record in the subform. If I click on the subform
record selector of a record where 'Spanish' is False, then the
background color of the three fields becomes 16777164 for every record
in the subform.
A single main form record can have multiple subform records, and those
subform records can have any number of records where 'Spanish' is True
or False.
How can I set up my code so that the three fields in the subform have
the correct background color for each condition of 'Spanish' in each
record?
Thanks for your help!
CSDunn