Results 1 to 6 of 6
  1. #1
    Join Date
    Aug 2002
    Posts
    78

    Unanswered: Conditional Formatting in Controls on a Report

    I have a Report based on a query with Approx 63 fields on it. (Five Genereation Pedigree) I need to be able format the text of either the primary Text box or subsequent 62 combo boxes to Red if the Champion field (yes/no) is checked. I have tried help and am having difficulty in syntax and using Build etc.

    Any suggestions?

    Primary Text Field is called DogName

    Subsequent combo box names are
    tblDogs.SireID
    tblDogs.DamID
    tblDogs_1.SireID
    tblDogs_1DamID

    Through
    tblDogs_30.SireID
    tblDogs_30.DamID

    Any Assistance would be greatful.

    Basicly, if any dog on the pedigree has a check in the Champion box I need the font in the control they are in to appear in red.

    thank you for your assistance.
    Last edited by t_galownia; 01-03-03 at 12:42.

  2. #2
    Join Date
    Nov 2002
    Location
    San Francisco
    Posts
    251

  3. #3
    Join Date
    Aug 2002
    Posts
    78
    Thank you SOOOOOOOO MUCH I really apreciate it. . . I do have one question if you have a chance. Is there a way to do it through Code and Loop the search on all the controls as opposed to putting that expression on Every control?

    Once again THANK YOU

    Thomas

  4. #4
    Join Date
    Aug 2002
    Posts
    78
    Actually that only half worked. The champion on control on the form/report is in reference to the initial dog. The subsequent 62 dogs are it's ancestors.

    my set up is like this

    tblDogs
    DogID
    SireID
    DamID
    DogName
    Champion


    With what you directed me to, if the initial Dog on the form/report is a champion. . . all dogs will show in red. What I need is for the dogs to show in red ONLY IF for the value in the field' Champion is "true". Does that make sense? I hope I explained it correctly. IF there are 7 dogs on the form/report for a particular dog's pedigree that is a champion . . . then I need only those seven to show. Right now the expression is looking if the check box on the current form/report's record is showing as true. What I need it is to refer to the table and if that specific dog in the table has champion checked in it's own record. . .then I need it to show as red.

    I hope that wasn't too confusing. . . I could upload or email my db if you care to look at it and if you are willing to help. Please let me know.

    Thank you for the link though. . . I was wondering how to get some of that to work.


  5. #5
    Join Date
    Nov 2002
    Location
    San Francisco
    Posts
    251
    I tested in in AccessXP


    jiri



    For Each mycontrol In Forms("myForm").Controls
    'If Left(mycontrol.Name, 3) = "chk" Then
    ' you can get FormatConditions only for TEXT and CheckBox Controls....
    ' I name all my check boxes CHKsomething.....
    Debug.Print "there are : " & mycontrol.FormatConditions.Count & " conditions on " & mycontrol.Name
    If mycontrol.FormatConditions.Count = 0 Then
    'if there are no conditions, I ADD one.....
    mycontrol.FormatConditions.Add acExpression, , "[myCondition] = 15"
    End If
    For i = 0 To mycontrol.FormatConditions.Count - 1
    Debug.Print " Condition " & i & " is " & mycontrol.FormatConditions(i).Enabled
    Debug.Print " Condition " & i & " expr1 " & mycontrol.FormatConditions(i).Expression1
    Debug.Print " Condition " & i & " expr2 " & mycontrol.FormatConditions(i).Expression2
    Debug.Print " Condition " & i & " backcolor " & mycontrol.FormatConditions(i).BackColor
    Debug.Print " Condition " & i & " ForeColor " & mycontrol.FormatConditions(i).ForeColor
    Debug.Print " Condition " & i & " FontBold " & mycontrol.FormatConditions(i).FontBold
    ' other properties are FontItalic, FontUInderlined, Type, Operator
    Next
    'End If
    Next

  6. #6
    Join Date
    Aug 2002
    Posts
    78
    WOW I will check this out and give it a shot. I am not all that up on coding so that looks a bit intimidating. I am currently using Access 97 at work. . .2K at home Hopefully at end of month I will have new computer with XP etc so cross your fingers.

    I do have one question should you have the time . . you said. . .

    " you can get FormatConditions only for TEXT and CheckBox Controls...."

    Does this mean the combo boxes can't be formatted or am I misunderstanding what you commented there please?

Posting Permissions

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