Share via

Conditional formatting text align

Anonymous
2018-08-22T20:26:10+00:00

I am trying to conditionally format some text boxes of a subform, in Continuous format. I was able to put the below code together but it changes ALL records based on the conditions of the current record selected(I get that this is because I have it in the Form_Current event), but I cant figure out how to make it work like this for all records at once (like it would if I used the conditional formatting icon, which doesnt have the option to change font size and alignment). 

Private Sub Form_Current()

If Me.[RoleCombo] = 3 Then

    Me.[Character].FontSize = 10

    Me.PeopleCombo.TextAlign = 3

Else: Me.Character.FontSize = 8

    Me.PeopleCombo.TextAlign = 1

    End If

End Sub

I found a suggestion that it should be Detail_Format() instead of  Form_Current() but that doesnt work, and I feel like Ive tried almost every other event option. What is the correct way to use conditional formatting for a subform based on other controls?

Microsoft 365 and Office | Access | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

2 answers

Sort by: Most helpful
  1. Anonymous
    2018-08-22T20:53:06+00:00

    I'm afraid you can't implement conditional formatting this way, because in a continuous form, when you change the properties of a control you change them for all instances of that control, in all the rows displayed on the form.  Only true conditional formatting, as understood by Access, will allow format properties to vary from row to row, and then only the set of properties that are supported.  Through some trickery, you can usually *hide* a control conditionally, but I don't know a way to do what you're looking for.

    That doesn't rule out the possibility that someone has found a cunning workaround, and I'll take a moment to look for one, but I don't hold out much hope.

    Was this answer helpful?

    0 comments No comments
  2. Deleted

    This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.


    Comments have been turned off. Learn more