Page 2 of 3 FirstFirst 123 LastLast
Results 16 to 30 of 31
  1. #16
    yes sir is offline Competent Performer
    Windows Vista Access 2007
    Join Date
    Aug 2010
    Posts
    159

    And I tried to attach, but it keeps failing to upload.

    I've compacted and I zipped, is there anything else I can try?

  2. #17
    yes sir is offline Competent Performer
    Windows Vista Access 2007
    Join Date
    Aug 2010
    Posts
    159
    Alright, I have a sample of the database attached with the main objects that are needed for this coloring project/coding.

  3. #18
    ajetrumpet is offline VIP
    Windows Vista Access 2007
    Join Date
    Mar 2010
    Location
    N/A
    Posts
    2,694
    there's confusion here. this code of yours:
    Code:
    Private Sub Report_Load()
        If Me.Team = "Atlanta Hawks" Then
            Me.Detail.BackColor = vbRed
        If Me.Team = "Boston Celtics" Then
            Me.Detail.BackColor = vbGreen
        End If
        End If
    End Sub
    looks at a header control. I was under the impression that there was one report for each TEAM, and no other factors. That's not the case. One report is for one team, and you have records that pertain to different activities for that one team. So what you should have said was that you want colors based off the different activities for one team. The thread would've been shorter and less time consuming for you. Just FYI!

    so you have 2 subreports. neither one has anything to do with the main report, which is really just a header control and nothing else. With all that said, to use the code you've been using, it might work if you changed the back color of the SUBFORMS, and referenced their controls as well. That's the criteria, the way I see it, NOT the header label control.

    Right now, it's doing exactly what you asked!

  4. #19
    yes sir is offline Competent Performer
    Windows Vista Access 2007
    Join Date
    Aug 2010
    Posts
    159
    Quote Originally Posted by ajetrumpet View Post
    there's confusion here. this code of yours:
    Code:
    Private Sub Report_Load()
        If Me.Team = "Atlanta Hawks" Then
            Me.Detail.BackColor = vbRed
        If Me.Team = "Boston Celtics" Then
            Me.Detail.BackColor = vbGreen
        End If
        End If
    End Sub
    looks at a header control. I was under the impression that there was one report for each TEAM, and no other factors. That's not the case. One report is for one team, and you have records that pertain to different activities for that one team. So what you should have said was that you want colors based off the different activities for one team. The thread would've been shorter and less time consuming for you. Just FYI!

    so you have 2 subreports. neither one has anything to do with the main report, which is really just a header control and nothing else. With all that said, to use the code you've been using, it might work if you changed the back color of the SUBFORMS, and referenced their controls as well. That's the criteria, the way I see it, NOT the header label control.

    Right now, it's doing exactly what you asked!
    Don't worry about any of that. I have some stuff hidden that might be keeping you from seeing what is actually going on.

    Anyways, I have switched to using Case Statements. Not quite sure how to reference my table 'NBATeamColors' and pull the colors that way.

    Here is my code:
    Code:
    Private Sub Report_Load()
        Select Case Me.Team
            Case "Atlanta Hawks"
                Me.Team.ForeColor = vbRed
            Case "Boston Celtics"
                Me.Team.ForeColor = vbBlue
            Case "Charlotte Bobcats"
                Me.Team.ForeColor = vbBlack
            Case "Chicago Bulls"
                Me.Team.ForeColor = vbWhite
        End Select
    End Sub

  5. #20
    ajetrumpet is offline VIP
    Windows Vista Access 2007
    Join Date
    Mar 2010
    Location
    N/A
    Posts
    2,694
    so you got it fixed?

  6. #21
    yes sir is offline Competent Performer
    Windows Vista Access 2007
    Join Date
    Aug 2010
    Posts
    159
    You know what, I might just ditch this table and keep using this Case Select statements. Working out pretty well so far and really don't see any problems with it other than it will take awhile to change the colors for 30 teams and however many pieces of the report I want to change based on the team.

    Unless you all recommend using the table. It just seems as though there will be more code I would have to write if I went that route.

    Thanks for the help

  7. #22
    pbaldy's Avatar
    pbaldy is online now Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    I think Adam's table idea is the way to go. Even if you don't include it in the report data and do lookups, it's much more maintainable. Presumably you'll have other forms and reports where you might want to do something similar. It's a lot more flexible to just go to the table to add a team, change colors, etc, than to have to change this code everywhere it might appear.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  8. #23
    pbaldy's Avatar
    pbaldy is online now Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    By the way, you'll have less code with the table, not more. With your method, you'll have 30 Case statements, so at least that many lines. With the table and Adam's DLookup, you have one line.

    I will note that I've never had success with color represented that way (#FFFFFF). I've only gotten numerical equivalents to work. Attached is a table I use to dynamically set the colors of labels representing cars, based on their status. Maybe it's because I've only tried with 2000.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  9. #24
    ajetrumpet is offline VIP
    Windows Vista Access 2007
    Join Date
    Mar 2010
    Location
    N/A
    Posts
    2,694
    Quote Originally Posted by pbaldy View Post
    I think Adam's table idea is the way to go.
    it's not mine, it's yours, sir. Remember?

    And sir, the first thing that I would recommend about this database (and I'm being serious here) is to NOT think so much about it.

    I remember talking to you a while back about this, and unless you know this coach/scout really well, remember that people right now will do almost anything to get something for free. And you're doing this for free (or has that changed since then?).

    I don't want to say that this guy is using you in this way, but I will say that he wouldn't get more than a couple hours of advice out of me unless I got a check in the mail.

    Just be careful bud...I surely wouldn't want to see you waste your time on this, just to find out that the future value of the relationship with this guy doesn't yield anything other than a "thank you". You sure have invested a lot more time than the average bear would.

  10. #25
    pbaldy's Avatar
    pbaldy is online now Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    You suggested the table in the first response Adam, I just suggested joining it in a query rather than using DLookup's. Credit given where credit is due!
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  11. #26
    ajetrumpet is offline VIP
    Windows Vista Access 2007
    Join Date
    Mar 2010
    Location
    N/A
    Posts
    2,694
    Quote Originally Posted by pbaldy View Post
    You suggested the table in the first response Adam, I just suggested joining it in a query rather than using DLookup's. Credit given where credit is due!
    You got me. Okay...

    and hey, I'm 99% sure I remember alpha numerics working in code when I did an alternating color pattern for a report once. I've never had 2000 though. Only 03 and up. I'll have to confirm that sometime. Thanks. Interesting thing too, that only the integer equivs work in 2000. Are you sure about that? Have you tried them with and without the # signs? And you're talking about control object colorings that are set in code?

  12. #27
    pbaldy's Avatar
    pbaldy is online now Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    I briefly tested a variation of what you posted and got a type mismatch error. Switched it to the numeric value and it worked fine. When you select a color in the properties window it gives you the number, and I've noticed in 2007 it gives the "#" value.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  13. #28
    yes sir is offline Competent Performer
    Windows Vista Access 2007
    Join Date
    Aug 2010
    Posts
    159
    I found a website that has the Access 2007 numerical equivalents for certain colors, so I have just been using those.

    More importantly, I haven't the slightest clue as to how to reference the table with the color codes. Could one of you all be kind enough to write up a sample line of code as to how this is done?

    Adam, what I'm working on now is for myself. That guy has his copy I finished back in November, looking back, sure I would love to have been paid, but for me knowing a "NBA guy" was more important and I didn't want to screw that up.

    With that said, when he comes asking for more I will be asking for a check.

  14. #29
    yes sir is offline Competent Performer
    Windows Vista Access 2007
    Join Date
    Aug 2010
    Posts
    159
    Could I set this table up to display a background image based on the team as well?

  15. #30
    yes sir is offline Competent Performer
    Windows Vista Access 2007
    Join Date
    Aug 2010
    Posts
    159
    Sticking with the Case Select. Can't figure out how to reference the table or even how to reference a particular cell in the table.

Page 2 of 3 FirstFirst 123 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Image change based on combo box
    By bosve73 in forum Forms
    Replies: 4
    Last Post: 08-09-2010, 02:23 AM
  2. Replies: 4
    Last Post: 01-19-2010, 05:36 AM
  3. Run Report with Prompt for Field Criteria
    By diane802 in forum Reports
    Replies: 4
    Last Post: 01-15-2010, 02:31 AM
  4. query - criteria based on another row field value
    By techexpressinc in forum Queries
    Replies: 1
    Last Post: 05-29-2009, 04:17 PM
  5. Replies: 1
    Last Post: 12-30-2005, 10:23 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums