Results 1 to 6 of 6
  1. #1
    Join Date
    Oct 2004
    Posts
    4

    Unanswered: Conditional Formating in Reports Access 97

    Dear All,

    Please can you help me, I am trying to Conditionally format a report by bold formatinf any line that contains the word Gross loss in it in my report.

    I have used the ON FORMAT option in the detail and have then stepped through the VBA code which changes the option from true to BOLD and then back to false to normal again. But nothing is happening on the report, everything remains in normal font.

    I am sure its something simple, but I just can't work it out.

    The code I am using is:-

    Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)

    If Me.tbitemName = ("Gross Losses") Or Me.tbitemName = ("GROSS LOSS RATIO") Then
    Me.FontBold = True
    Else: Me.FontBold = False
    End If

    End Sub

    Please help,
    Thanks
    Shaun

  2. #2
    Join Date
    Oct 2003
    Location
    Ger
    Posts
    1,969
    Provided Answers: 1
    Try teh next:
    PHP Code:
      Private Sub Detail_Format(Cancel As IntegerFormatCount As Integer)
         If 
    Me.tbitemName "Gross Losses" Or Me.tbitemName "GROSS LOSS RATIO" Then
           Detail
    .FontBold True
        
    Else 
          
    Detail.FontBold False
       End 
    If

     
    End Sub 

  3. #3
    Join Date
    Oct 2004
    Posts
    4
    Quote Originally Posted by hammbakka
    Try teh next:
    PHP Code:
      Private Sub Detail_Format(Cancel As IntegerFormatCount As Integer)
         If 
    Me.tbitemName "Gross Losses" Or Me.tbitemName "GROSS LOSS RATIO" Then
           Detail
    .FontBold True
        
    Else 
          
    Detail.FontBold False
       End 
    If

     
    End Sub 
    Thanks for that,

    Unfortunately it didn't work, Fontbold is not a member of Detail.

    Thanks
    Shaun

  4. #4
    Join Date
    Oct 2003
    Location
    Ger
    Posts
    1,969
    Provided Answers: 1

    Lightbulb

    No problem
    I tried this and functions good

    Detail.Controls("yourTestBoxNameInReport").FontBol d = True

  5. #5
    Join Date
    Oct 2004
    Posts
    4
    Quote Originally Posted by hammbakka
    No problem
    I tried this and functions good

    Detail.Controls("yourTestBoxNameInReport").FontBol d = True
    It still does not work, as the compiler says the expression is closed.

    Any more ideas??? Or do you know how I can get around this problem?

    Thanks again
    Shaun

  6. #6
    Join Date
    Oct 2004
    Posts
    4

    Talking

    The solution is:-

    Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
    'Bold faces the lines where gross Losses occur
    Dim ctl As Control

    If Controls("TextboxName").Value = ("Gross Losses") Or Controls("Textbnoxname").Value = ("GROSS LOSS RATIO") Then
    REM This line will bold everything in the detail section
    For Each ctl In Me.Detail.Controls
    ctl.FontBold = True
    Next
    Else
    For Each ctl In Me.Detail.Controls
    ctl.FontBold = False
    Next
    End If
    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
  •