• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 434
  • Last Modified:

Conditional Formatting with More than 3 conditions

Hello Experts,

I have a subform (continuous), where I need to do a conditional formatting on a field based on the values on two other fields within the same row, but Access allows only 3 conditions + 1 Defaullt.

In my case, what i -need to do is:

If (Me.txtProd = "T1") And (Me.txStatus = "O") Then
    Bold = True
    BackColor = red
ElseIf (Me.txtProd = "T2") And (Me.txStatus = "O") Then
    Bold = True
    BackColor = pink
ElseIf N1, N2, C1, C2, E (5 more elseif's)
else
     bold = false
     backcolor = none
End If

Any help will be appreciated

Thank you
0
APD_Toronto
Asked:
APD_Toronto
  • 3
  • 3
  • 3
  • +3
1 Solution
 
Rey Obrero (Capricorn1)Commented:
see this link

Extending the Functionality of Conditional Formatting in Access
http://msdn.microsoft.com/en-us/library/aa139965%28office.10%29.aspx
0
 
peter57rCommented:
There is no way past the limit of 3 concurrent formats (+default).

Unless you upgrade to A2010, where there are 50.
0
 
peter57rCommented:
Sorry cap but I don't think that will help.

As far as I know, all it does it give you the ability to change which 3 formats are currently being used; on a single form this can give the illusion of there being more than 3 but only 3 are available at any time.
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
Rey Obrero (Capricorn1)Commented:
not sure, but it might...
0
 
ErezMorCommented:
From a2007 onward, you can use richtext fields (both in table columns and forms)
This requires some pre-planning , but with this feature you can have as many different visual effects on a continuous form as your pc display can handle
I actually implemented this in 2 of my projects, so ask for any specifics if you need
Again, you'll need to make some structural changes for it to work (for example, the row displayed is a mock up of actual data decorated by tags, and therefore isn't  edited directly but by a seperrate form
0
 
APD_TorontoAuthor Commented:
Erez,

how would i achieve my goal from my orig post with rich tex/

Does anyone know if i can run A2007 and A2010 RunTime on 1 machine? Or, if i se 2010 with the 50 conditions, will it work in 2007?
0
 
Jeffrey CoachmanCommented:
If it were me, I would just use a form in "single form" view.
Then you can use code (like what you posted) on the current event of the form to format the controls based on as many conditions as you need.


FWIW, the reason why CF is limited to 3 conditions is that beyond that you can lose track of what is what.
Then you end up having to create a color legend, ...then write code to update it, ...etc


Another option could be to create a Filter form to set/filter for each "Condition".
Then simply open the form and only show those records matching the condition.

A final option would be to use a report for this.
Then you could keep the "tabular/Continuous" look of the form, but still use code (this time on the Detail Format event) to create your more than 3 conditions.


JeffCoachman
0
 
Martin LissRetired ProgrammerCommented:
Select Case True
    Case (Me.txtProd = "T1") And (Me.txStatus = "O")
        Bold = True
        BackColor = red
    Case (Me.txtProd = "T2") And (Me.txStatus = "O")
        Bold = True
        BackColor = pink
    Case "some condition"
        ' do something
    Case "some other condition" ' add as many other cases as you like
        ' do another thing
    Case Else
        Bold = False
        BackColor = none
End Select

Open in new window

0
 
APD_TorontoAuthor Commented:
If i do this, all rows change based on the last value changed


Private Sub setBGcolor()
    
    With Me.txtPickupTime
    
        If (Me.txtProdID = "T1") And (cboPickup.Value = "O") Then
        
            .BackColor = RGB(255, 0, 0)
            .FontBold = True
        
        ElseIf (Me.txtProdID = "T2") And (cboPickup.Value = "O") Then
        
            .BackColor = RGB(255, 51, 153)
            .FontBold = True
        
        Else
            
         '   .FontBold = False
            
        End If
        
        'MsgBox "COLOR"
        
        'me.cboPickup.Format = .Format
    End With
    
End Sub

Open in new window

0
 
Jeffrey CoachmanCommented:
So using a single form where this will work directly is not an option?

You seemed to have ignored my post...
0
 
peter57rCommented:
You cannot achieve what you want through code.
Conditional formatting is the only relevant tool in a continuous form and you already know the limit for that.
0
 
APD_TorontoAuthor Commented:
boag - i thought i replied, guess not

i did not understand your post
0
 
Jeffrey CoachmanCommented:
OK, to avoid confusion, I'll let you continue with the previous Experts
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 3
  • 3
  • 3
  • +3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now