I’m trying to format a control on a continuous subform based on the value of another control on that same subform.
Main form”frm01Study” has several subforms, one of which is “frm03SpecialtyAdoptions” in continuous view. Two of the controls on this subform are AdoptedSpecialty (a text box) and PrimarySpecialty (a Yes/No checkbox with Visible property set to No)
On this form the users do not interact with this subform at all (they just view it), input being done via a different front-end. Anyway, if the hidden box is checked I want the textbox to appear in bold black font, otherwise in normal grey font. This is what I came up with
But when I open the form, the first record just takes the default setting from the property sheet, although all subsequent records are displayed properly. I have tried the same code in the OnOpen, OnLoad and OnCurrent events of the subform, but I can’t get it to work reliably. Is there another step I need to do?
Thanks,
Pat
Main form”frm01Study” has several subforms, one of which is “frm03SpecialtyAdoptions” in continuous view. Two of the controls on this subform are AdoptedSpecialty (a text box) and PrimarySpecialty (a Yes/No checkbox with Visible property set to No)
On this form the users do not interact with this subform at all (they just view it), input being done via a different front-end. Anyway, if the hidden box is checked I want the textbox to appear in bold black font, otherwise in normal grey font. This is what I came up with
Code:
Private Sub Detail_Paint()
If Me.PrimarySpecialty.Value = True Then
Me.AdoptedSpecialty.ForeColor = 0 'Black
Me.AdoptedSpecialty.FontWeight = 700 'Bold
Else
Me.AdoptedSpecialty.ForeColor = 12632256 'Grey
Me.AdoptedSpecialty.FontWeight = 400 'Normal
End If
End Sub
But when I open the form, the first record just takes the default setting from the property sheet, although all subsequent records are displayed properly. I have tried the same code in the OnOpen, OnLoad and OnCurrent events of the subform, but I can’t get it to work reliably. Is there another step I need to do?
Thanks,
Pat