Results 1 to 6 of 6
  1. #1
    Join Date
    Sep 2003
    Posts
    228

    Unanswered: Conditional Formatting on Subform

    I have a main form, Projects, with a subform, Agencies. Each project will have one or more Agencies. I have the Agency subform setup in the Continuous Forms View. All I want to do is change the color of a textbox (on the agency subform) if a field is null. My trouble is that this formatting wants to occur for all agencies and not just one of possible many.

    So I guess my real question is how do I access each one of the agencies "form" and alter the color of a control?

  2. #2
    Join Date
    Sep 2002
    Location
    Finland
    Posts
    34
    If you use access97 you can use format property and put some text when field is null also you can change font color.

    Example: @;"Hello!"[Red]

    If you use newer version you can use format-menu and there 'format if... or conditional formating...' (I don't what it is in english version). There you can change also BackColor.

  3. #3
    Join Date
    Sep 2003
    Posts
    228
    The "Conditional Formatting" works fabulous if the condition you want to test is the same field you wish to format.

    What I want is If field A is = X then field B.backcolor = red (or something along these lines.

    Now if I could just figure out how to do it...

  4. #4
    Join Date
    Sep 2002
    Location
    Finland
    Posts
    34
    I have conditional formating in CLITMIDT field and there is criteria/function/clause
    [PCLUNT]="NA" Or [PCLUNT] Is Null

    "What I want is If field A is = X then field B.backcolor = red (or something along these lines."
    In B field use clause
    [A]="X"

  5. #5
    Join Date
    Sep 2003
    Posts
    228
    Thank you mns. You have made my day.

    I set Condition 1 to "Expression Is" and then I entered "myfield Is Not Null"

    This works exactly as I wanted. I just wish I could have figured out how to code it in VB so it wasn't hidden away...

  6. #6
    Join Date
    Sep 2002
    Location
    Finland
    Posts
    34
    You could use something like this.

    Private Sub Form_Open(Cancel As Integer)

    Dim frm As FormatCondition
    Set frm = Me.somefield.FormatConditions.Add(acExpression, , "'X'='X'")

    frm.BackColor = 255

    End Sub

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •