Results 1 to 9 of 9
  1. #1
    dcdimon's Avatar
    dcdimon is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Sep 2013
    Location
    Bradenton, FL
    Posts
    71

    Question View conditional formatting values outside of dialog box

    I'm looking to see if it's possible to view the values of a conditional format that was set up via the conditional format dialog box via VBA or something similar. There are several forms with conditional formats for when a reading is out of spec and I'd like to be able to get that range programmatically from the conditional format.Because I haven't found a single thing that even hints that this is do-able, I'm beginning to think that it's not. However, before i go and try to redo the formatting via a VBA process (using a lookup table of the min/max tables on all 50 forms) I thought I'd ask the wizards on this forum. Anyone?Fingers crossed.DD

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,931
    It is possible to programmatically set Conditional Formatting properties. This article concerned pre-2010 Access http://blogs.msdn.com/b/frice/archiv...08/151178.aspx

    I suppose can read the existing property settings as well. Why exactly would you need to?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    Here's some code that goes through conditional formatting information:

    http://msdn.microsoft.com/en-us/libr...ice.10%29.aspx

  4. #4
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    Because the formatting does not happen until after a condition is met you would have to write VBA to observe the condition, regardless of what acction the VBA takes.

    Write code to see if conditional formatting will be implemented.
    Write code to format conditionaly.

    I see the same amount of coding either way. Perhaps more coding to determine what the user decided to do with the format window thing. (Not too sure what all you are trying to do here)

  5. #5
    dcdimon's Avatar
    dcdimon is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Sep 2013
    Location
    Bradenton, FL
    Posts
    71
    Quote Originally Posted by ItsMe View Post
    Because the formatting does not happen until after a condition is met you would have to write VBA to observe the condition, regardless of what acction the VBA takes.

    Write code to see if conditional formatting will be implemented.
    Write code to format conditionaly.

    I see the same amount of coding either way. Perhaps more coding to determine what the user decided to do with the format window thing. (Not too sure what all you are trying to do here)
    What I'm trying to do is use the conditions for the control so I can evaluate the entry in a query to determine if out of range. I was hoping that I wouldn't have to re-enter the hi/lo values in my script, but just refer to them from the conditional format, which is entered via the conditional formatting on the Access ribbon, not VBA.

    When the forms were made, they weren't thinking about how we'd want to evaluate/see the data on the out-side. Looking back at this I think the best thing would have been to create a table that holds the hi/lo data by field name and have a script that looks up the values to set the control back color. Then I could use that table to evaluate the field data to see if it's out of compliance and populate a report/query/scorecard.

    I've decided that the conditional formatting dialog box is internal to Access and the values (arguments) that are entered can't be seen outside of that dialog box. As this seems to be true I'm in the process of putting together a table for the values. I was just trying to avoid this.

    However, even though I LOVE making data tables, if I'm incorrect I'd welcome knowing that. :P


    DD

  6. #6
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    I think you are far better off creating the tolerances in a table, then comparing that to your score (what you're on the road to doing) conditional formatting of values that never change will turn your database into a not so useful hunk of junk over time.

  7. #7
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    Quote Originally Posted by dcdimon View Post
    ...I've decided that the conditional formatting dialog box is internal to Access and the values (arguments) that are entered can't be seen outside of that dialog box. As this seems to be true I'm in the process of putting together a table for the values. I was just trying to avoid this.

    DD
    Can't just do the calculation of historical data?
    If you do not want to run the calculation again, store the High Low and refer to that for formatting and analyzing historical data

  8. #8
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,931
    In case anyone is interested. It is possible to view the Conditional Formatting settings, including the conditional expression. This worked for me:

    Debug.Print Me.SectionName.FormatConditions(0).Expression1
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  9. #9
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    That's in the link I posted too

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

Similar Threads

  1. Replies: 21
    Last Post: 01-21-2015, 05:28 AM
  2. Replies: 2
    Last Post: 11-06-2013, 02:12 PM
  3. Replies: 6
    Last Post: 05-26-2013, 09:10 PM
  4. Replies: 1
    Last Post: 04-24-2013, 08:51 PM
  5. Conditional Formatting
    By DanOzDirect in forum Reports
    Replies: 3
    Last Post: 07-21-2010, 08:49 PM

Tags for this Thread

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