FormatConditions Entire Row

Discussion in 'Microsoft Access Form Coding' started by Phil, Oct 15, 2003.

  1. Phil

    Phil Guest

    Does anyone know how to tchange the color of all fields
    in on row of a form?

    Using the code below in the CurrentRecord of the form, I
    can get a single field's Unique value to turn yellow, but
    I also need the entrie row to turn yellow. The fields in
    the rest on the row may not be Unique.

    Private Sub Form_Current()

    Dim fcd As FormatCondition

    With Form_frmTransactions_SGH.CCN
    With .FormatConditions
    .Delete
    Set fcd = .Add(acFieldValue, acEqual, "'" &
    Form_frmTransactions_SGH.CCN & "'")
    fcd.BackColor = vbYellow
    End With
    End With

    End Sub

    Thanks, phil
     
    Phil, Oct 15, 2003
    #1
    1. Advertisements

  2. Phil wrote:

    >Does anyone know how to tchange the color of all fields
    >in on row of a form?
    >
    >Using the code below in the CurrentRecord of the form, I
    >can get a single field's Unique value to turn yellow, but
    >I also need the entrie row to turn yellow. The fields in
    >the rest on the row may not be Unique.
    >
    >Private Sub Form_Current()
    >
    > Dim fcd As FormatCondition
    >
    > With Form_frmTransactions_SGH.CCN
    > With .FormatConditions
    > .Delete
    > Set fcd = .Add(acFieldValue, acEqual, "'" &
    >Form_frmTransactions_SGH.CCN & "'")
    > fcd.BackColor = vbYellow
    > End With
    > End With
    >
    >End Sub


    Sorry but I don't recognize what you're doing there. It
    sort of looks like you're manipulating the format conditions
    of a control, but I can't figure out why. Maybe you just
    got started down a twisty path? or maybe I don't understand
    what you're trying to do.

    To make the entire detail section of a form display a
    conditional background color, first make all of the
    section's controls BackStyle Transparent. Then add a
    rectangle control the same height and width as the entire
    section, use the Formst Send to Back menu item to place it
    behind all the other controls. Now you can use Conditional
    Formatting on the one rectangle control to control the color
    of the entire section.

    --
    Marsh
    MVP [MS Access]
     
    Marshall Barton, Oct 16, 2003
    #2
    1. Advertisements

  3. Also it kinds of defeats the purpose of CF to modify it on every Current
    event.

    Marshall due to a bug in CF you have to setup the FormatConditions
    object programmatically in order to ensure that the background TextBox
    control's Enabled property setting will be respected. Sample code here:
    http://www.lebans.com/conditionalformatting.htm

    Just my $.02

    --
    Stephen Lebans
    http://www.lebans.com
    Access Code, Tips and Tricks
    Please respond only to the newsgroups so everyone can benefit.


    "Marshall Barton" <> wrote in message
    news:...
    > Phil wrote:
    >
    > >Does anyone know how to tchange the color of all fields
    > >in on row of a form?
    > >
    > >Using the code below in the CurrentRecord of the form, I
    > >can get a single field's Unique value to turn yellow, but
    > >I also need the entrie row to turn yellow. The fields in
    > >the rest on the row may not be Unique.
    > >
    > >Private Sub Form_Current()
    > >
    > > Dim fcd As FormatCondition
    > >
    > > With Form_frmTransactions_SGH.CCN
    > > With .FormatConditions
    > > .Delete
    > > Set fcd = .Add(acFieldValue, acEqual, "'" &
    > >Form_frmTransactions_SGH.CCN & "'")
    > > fcd.BackColor = vbYellow
    > > End With
    > > End With
    > >
    > >End Sub

    >
    > Sorry but I don't recognize what you're doing there. It
    > sort of looks like you're manipulating the format conditions
    > of a control, but I can't figure out why. Maybe you just
    > got started down a twisty path? or maybe I don't understand
    > what you're trying to do.
    >
    > To make the entire detail section of a form display a
    > conditional background color, first make all of the
    > section's controls BackStyle Transparent. Then add a
    > rectangle control the same height and width as the entire
    > section, use the Formst Send to Back menu item to place it
    > behind all the other controls. Now you can use Conditional
    > Formatting on the one rectangle control to control the color
    > of the entire section.
    >
    > --
    > Marsh
    > MVP [MS Access]
     
    Stephen Lebans, Oct 16, 2003
    #3
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Guest

    Synchronizing Combo Box Updates the entire row

    Guest, Aug 1, 2004, in forum: Microsoft Access Form Coding
    Replies:
    0
    Views:
    168
    Guest
    Aug 1, 2004
  2. postman

    How to select an entire row And append it?

    postman, Apr 19, 2005, in forum: Microsoft Access Form Coding
    Replies:
    1
    Views:
    199
    Albert D. Kallal
    Apr 19, 2005
  3. postman

    How to highlight an entire row of records and hold this format

    postman, Apr 20, 2005, in forum: Microsoft Access Form Coding
    Replies:
    21
    Views:
    447
    postman
    May 14, 2005
  4. Guest

    create new row/record using existing row as source

    Guest, Sep 14, 2006, in forum: Microsoft Access Form Coding
    Replies:
    4
    Views:
    257
    Marshall Barton
    Sep 15, 2006
  5. Norbert Meiss

    FormatConditions

    Norbert Meiss, Sep 6, 2009, in forum: Microsoft Access Form Coding
    Replies:
    0
    Views:
    537
    Norbert Meiss
    Sep 6, 2009
Loading...

Share This Page