Results 1 to 5 of 5
  1. #1
    3 Star Lounger
    Join Date
    Sep 2001
    Location
    Stuck at work..., Missouri, USA
    Posts
    248
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Different color text on report items? (A97)

    I am working on an inventory program for some friends.

    They will be using this program to also print labels for the boxes their inventory is in.

    Each item on the label needs to be a different color, but the color is specific to the item on the label.

    I can't say that Field X is always Blue and Field Y is always Black. X can be any color depending on what is ordered.

    I have the colors stored as text along with the inventory item descritptions (vbCyan, vbBlack, etc...) in a table.

    How do I tell the report to use that color?

    Thanks!
    <font face="Comic Sans MS">Morgan Erickson</font face=comic>
    morgan.erickson@sprint.com
    <img src=/S/flags/USA.gif border=0 alt=USA width=30 height=18>-From <img src=/S/flags/Colorado.gif border=0 alt=Colorado width=30 height=18> but living in <img src=/S/flags/Missouri.gif border=0 alt=Missouri width=30 height=18>...and working in Kansas.

  2. #2
    3 Star Lounger
    Join Date
    Sep 2001
    Location
    Stuck at work..., Missouri, USA
    Posts
    248
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Different color text on report items? (A97)

    I got it...

    I had tried:
    <pre>Private Sub Detail_Format(Cancel as Integer, FormatCount as Integer)
    me.txtField1.ForeColor = [Color]
    End Sub
    </pre>



    But I had to go with this:
    <pre>Private Sub Detail_Format(Cancel as Integer, FormatCount as Integer)
    Select Case [Color]
    Case "vbCyan"
    me.txtField1.ForeColor = vbCyan
    Case "vbRed"
    me.txtField1.ForeColor = vbRed
    End Select
    End Sub
    </pre>

    <font face="Comic Sans MS">Morgan Erickson</font face=comic>
    morgan.erickson@sprint.com
    <img src=/S/flags/USA.gif border=0 alt=USA width=30 height=18>-From <img src=/S/flags/Colorado.gif border=0 alt=Colorado width=30 height=18> but living in <img src=/S/flags/Missouri.gif border=0 alt=Missouri width=30 height=18>...and working in Kansas.

  3. #3
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Sint Niklaas, Belgium
    Posts
    2,778
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Different color text on report items? (A97)

    You can use the first syntax but then you have to store the numbers in the table instead of the vb constant.
    Francois

  4. #4
    3 Star Lounger
    Join Date
    Sep 2001
    Location
    Stuck at work..., Missouri, USA
    Posts
    248
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Different color text on report items? (A97)

    I had tried the Hex value, but I got a Type Mismatch error...
    <font face="Comic Sans MS">Morgan Erickson</font face=comic>
    morgan.erickson@sprint.com
    <img src=/S/flags/USA.gif border=0 alt=USA width=30 height=18>-From <img src=/S/flags/Colorado.gif border=0 alt=Colorado width=30 height=18> but living in <img src=/S/flags/Missouri.gif border=0 alt=Missouri width=30 height=18>...and working in Kansas.

  5. #5
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Sint Niklaas, Belgium
    Posts
    2,778
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Different color text on report items? (A97)

    I mean in the table itself.
    Where you have vbcayn, store 16776960
    for vbred, store 255
    for vbblack, store 0
    for vblue, store 16711680
    ect...
    Use an update query to change the constants to numbers and after that change the type of the field to numeric.
    This is theoretical as there is nothing wrong with the code you use now. It is only a little longer to write.
    Francois

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •