Results 1 to 3 of 3
  1. #1
    ccorley is offline Novice
    Windows 10 Access 2010 64bit
    Join Date
    Sep 2016
    Location
    Colorado Springs, CO
    Posts
    10

    How can I set a field property (eg. change back color) in a continuous form when the form is loaded?

    I've created a multiple-item form where each record will have a [DueDate] field that will be compared against the current date and the result is entered in the [FlagNumber] field. (Example: flagnumber = 1 if current date > DueDate, flagnumber = 2 if current date is between the [WarningDate] and the [DueDate].

    What I'd like to do is have the backcolor of the [Status] field change colors with respect to the Flagnumber value when the form is loaded to provide a visual indicator. I added the code below in the on-load event for the form but it only works for the first record. What do I need to do to make sure the code is performed for each record in the continuous form? Thanks in advanced for your help!

    If Date > DueDate Then
    FlagNumber = 1
    [Status].BackColor = vbRed

    ElseIf Date >= WarningDate And Date <= DueDate Then


    FlagNumber = 2
    [Status].BackColor = vbYellow

    Else

    FlagNumber = 3
    [Status].BackColor = vbGreen

  2. #2
    pbaldy's Avatar
    pbaldy is online now Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Look at Conditional Formatting on the ribbon.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,411
    correct terminiology is control rather than field.

    use conditional formatting on your status control

    Expression is----Date()>[DueDate]----set backcolor to red
    Expression is----Date()>=[WarningDate] AND Date()<=[DueDate]---- set backcolor to yellow

    no need for a third expression, just set the default colour to green.

    Note you cannot set the flag value conditionally - if it is potentially different for each record, you need to set it in your formrecordsource - and perhaps then simplify your conditional format formula

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Change color on textbox in a Continuous Forms
    By barby.pava in forum Forms
    Replies: 20
    Last Post: 03-30-2016, 08:01 AM
  2. Replies: 8
    Last Post: 11-28-2015, 12:00 PM
  3. Replies: 4
    Last Post: 03-31-2015, 06:35 PM
  4. Alternate Back Color Property
    By RayMilhon in forum Reports
    Replies: 5
    Last Post: 11-15-2012, 06:20 PM
  5. Replies: 8
    Last Post: 04-26-2012, 10:13 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums