Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Conditional formatting problem

Status
Not open for further replies.

ZABADAK

Programmer
Feb 24, 2005
39
US
I have this very complex report I've written. Its not a normal report. I build a custom table which just consists of detal lines. Hundreds of SQL calls are used to build this table. This table becomes the report control source. My problem is that the first column needs to print as bold or normal under programmatic control. The conditional formatting feature is useless as it has only 3 conditions. I'd like to be able to specify the formatting of columns as I build the report. Is there any way to achieve this ? I tried setting up two extra columns called Heading and Sub Heading but dont see how I can use them as I dont want the sequence of my built table to be altered as happens when I specify sorting and grouping.
 
On this same problem, what about conditional formatting in a report based on the value of the field? I.e., if the textbox has "HELLO" than the change the back color to X, or if it says "GOODBYE", then change to Y. I have about 50 of these to do.....

RK
 
The conditional format feature (in Access 2000) is pretty useless as it restricts you to just 3 conditions and a fixed set of comparisons. The properties are read-only and cannot be set in VBA (according to Microsoft HELP). When I tried to use this facility, I could not believe how pathetic it was. It looks like a feature Microsoft implemented without giving much thought to it.
 
This is how you can use it in VBA. You have to define each field and property each time. If the value is number then you don't have to use it in qoutes.
Case "Soft Drinks" / Case 12 like this

Also it is necessary to define Case Else.

Code:
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
Select Case Me.SubCategory.Value
Case "Soft Drinks"
    Me.SubCategory.FontBold = True
    Me.SubCategory.FontSize = 12
    Me.SubCategory.FontName = "Verdana"
    
Case "Chemical"
    Me.SubCategory.ForeColor = vbBlue
    Me.SubCategory.FontSize = 10
    Me.SubCategory.FontName = "Arial"
    
Case "General"
    Me.SubCategory.ForeColor = vbRed
    Me.SubCategory.FontSize = 11
    Me.SubCategory.FontName = "Times New Roman"
 
Case "Tea / Coffee"
    Me.SubCategory.ForeColor = vbGreen
    Me.SubCategory.FontSize = 8
    
Case Else
    Me.SubCategory.ForeColor = vbBlack
    Me.SubCategory.FontSize = 9
    Me.SubCategory.FontName = "Verdana"
    
End Select
End Sub

You can define as much as but it will take a lot of time to open the report.

Zameer Abdulla
Visit Me (New Look & style)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top