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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Colors

Status
Not open for further replies.

Blorf

Programmer
Dec 30, 2003
1,608
US
Is it possible in a report, on one field only, to have more than one font color? Example

Field1 = "Hello There Buddy"

I want Hello to be Blue, There to be Green, and Buddy to be Red.

Thanks.

Ascii dumb question, get a dumb Ansi
 
You can do this with a rich text control. Another method is:
Code:
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
    Dim lngY As Long
    lngY = 500
    CurrentX = 2000
    Me.FontSize = 20
    Me.FontName = "Arial"
    Me.FontBold = True
    Me.ForeColor = vbBlue
    CurrentY = lngY
    Me.Print "Hello "
    Me.ForeColor = vbGreen
    CurrentY = lngY
    Me.Print "There "
    CurrentY = lngY
    Me.ForeColor = vbRed
    Me.Print "Buddy"
End Sub

Duane
MS Access MVP
Find out how to get great answers faq219-2884.
 
This is fascinating. You can use a print command to a report control? I will certainly be playing with your code.

I greatly appreciate your help!


What controls are these refering to?
lngY = 500
CurrentX = 2000



Ascii dumb question, get a dumb Ansi
 
lngY is just a long numeric variable that I use to set CurrentY. Me.CurrentX and Me.CurrentY set the position to print on the report. I used a variable for CurrentY (lngY) so that if you want to change it, you only have to change it in one place rather than 3 places.

Comment out the last two "CurrentY = lngY" lines by placing a single quote in front like
' CurrentY = lngY
This will cause the text to stair-step.

Duane
MS Access MVP
Find out how to get great answers faq219-2884.
 
This will very much simplify report writing for my me at work. My employers sometimes have ideas about how a report should look, requireing some long hours for design.

This is good stuff. Thank you very much.



Ascii dumb question, get a dumb Ansi
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top