[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Conditional Formatting with More than 3 conditions

Posted on 2011-09-22
13
Medium Priority
?
433 Views
Last Modified: 2012-05-12
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
Comment
Question by:APD_Toronto
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
  • 3
  • +3
13 Comments
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 36581764
see this link

Extending the Functionality of Conditional Formatting in Access
http://msdn.microsoft.com/en-us/library/aa139965%28office.10%29.aspx
0
 
LVL 77

Accepted Solution

by:
peter57r earned 2000 total points
ID: 36581804
There is no way past the limit of 3 concurrent formats (+default).

Unless you upgrade to A2010, where there are 50.
0
 
LVL 77

Expert Comment

by:peter57r
ID: 36581817
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
NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 36581838
not sure, but it might...
0
 
LVL 12

Expert Comment

by:ErezMor
ID: 36581923
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
 

Author Comment

by:APD_Toronto
ID: 36581968
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
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 36582158
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
 
LVL 49

Expert Comment

by:Martin Liss
ID: 36582934
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
 

Author Comment

by:APD_Toronto
ID: 36587942
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
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 36588420
So using a single form where this will work directly is not an option?

You seemed to have ignored my post...
0
 
LVL 77

Expert Comment

by:peter57r
ID: 36588537
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
 

Author Comment

by:APD_Toronto
ID: 36588557
boag - i thought i replied, guess not

i did not understand your post
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 36588594
OK, to avoid confusion, I'll let you continue with the previous Experts
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
Traditionally, the method to display pictures in Access forms and reports is to first download them from URLs to a folder, record the path in a table and then let the form or report pull the pictures from that folder. But why not let Windows retr…
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
Suggested Courses

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question