Results 1 to 2 of 2
  1. #1
    4 Star Lounger
    Join Date
    Feb 2002
    Posts
    537
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Change of colour (Access 2000)

    In my continous form i tried to change the colour of the field called [4] when it is greater than the field [3] but my code seems not to work.i tried to put in the onopen event, on format event and in the Oncurrent event, but the results never appeared. What may be the reason ?

    Const conNormal = 400
    Const conHeavy = 900 ' exra bold
    Private Sub Form_Current()
    If Me![4] < Me![3] Then
    Me![4].FontWeight = conHeavy
    Me![4].ForeColor = 32768
    Else
    Me![4].FontWeight = conNormal
    Me![4].ForeColor = 0
    End If
    End Sub

    Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
    If Me![4] < Me![3] Then
    Me![4].FontWeight = conHeavy
    Me![4].ForeColor = 32768
    Else
    Me![4].FontWeight = conNormal
    Me![4].ForeColor = 0
    End If
    End Sub

    Private Sub Form_Open(Cancel As Integer)
    If Me![4] < Me![3] Then
    Me![4].FontWeight = conHeavy
    Me![4].ForeColor = 32768
    Else
    Me![4].FontWeight = conNormal
    Me![4].ForeColor = 0
    End If
    End Sub

  2. #2
    Gold Lounger
    Join Date
    Jun 2001
    Location
    Crystal Beach, FL, Florida, USA
    Posts
    3,436
    Thanks
    1
    Thanked 34 Times in 34 Posts

    Re: Change of colour (Access 2000)

    In continuous forms, you can't change the attributes of a single control at any time because (as you've discovered) it changes it for every control in that column.

    You must use Conditional Formatting. From the Main Menu Bar, select "Format", then from the dropdown select "Conditional Formatting". You can create up to 3 alternatives for each control.
    Mark Liquorman
    See my website for Tips & Downloads and for my Liquorman Utilities.

Posting Permissions

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