Results 1 to 2 of 2
  1. #1
    Join Date
    Nov 2009

    Unanswered: Font properties via VBA

    I have a year on year report and need certain years to tando out depending on the value of a field. My idea was to set an event prcedure on the report opening and setting the various fields with the following.

    if me.year = "2007" then
    me.year.fontbold = True
    me.year.fontsize = "10"
    me.year.textalign = "Center"
    end if

    I have tried this and varying other similar setups but no joy, any help would be great.

  2. #2
    Join Date
    Mar 2009
    Provided Answers: 14
    You may:

    - Use the Conditional Formating of the text boxes (Menu Format --> Conditional Formating).

    - Use the Format property of the Detail section of the report (Properties --> On Format):
    Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
        Me.Customer_Name.BackStyle = 1    ' default = 0 transparent
        If Me.Customer_Name = "Toyota" Then
            Me.Customer_Name.BackColor = vbRed
            Me.Customer_Name.BackColor = vbWhite
        End If
    End Sub
    The second solution is probably more appropriated in your case.
    Have a nice day!

Posting Permissions

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