Page 1 of 3 123 LastLast
Results 1 to 15 of 31
  1. #1
    tuniwes is offline Advanced Beginner
    Windows 8 Access 2013
    Join Date
    Nov 2015
    Posts
    43

    Change alternate back colour in detail section when field value changes

    Hi
    Below is an extract of a report grouped by Work Centre.
    I would like to change/switch to the alternate background colour only when the project field changes in value to group the background on like projects together.
    The value of the project field is infinitely variable



    I would be most grateful for any suggestions on how to do this


    Click image for larger version. 

Name:	Capture.JPG 
Views:	46 
Size:	141.3 KB 
ID:	33289

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    My first though is code in the format event of the detail section that compares the project to the previous project, which you'd hold in a report level variable and update each time it changed.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,778
    This might be a dumb question (in which case it would not be my first) but why don't you just create a report grouping based on project?
    For me, there is some uncertainty as to what is meant by "alternate background" color. There is an alternate row color property which I believe can be set during a report Format Detail event, but can this event also alter the back color of individual controls, especially without affecting every record where that control appears? For that, I wonder if conditional formatting is the way to go. Just askin'.

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    I took it to mean that the first row of a new project would be highlighted. Now that I read it again, I think all of the records of a given project would be the same color, which could still be accomplished with code. I don't see how with CF or the built-in alternate row color. But it wouldn't be the first time I was wrong...not even the first time today.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,895
    I thought about conditional formatting as well, especially since now possible to have 50 conditions. How many projects are there? 50 might not be enough. And conditional formatting is hard coding the project parameter. However, I am not sure hard-coding the project parameter can be avoided even in VBA, unless the Projects table has a 'color code' field.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  6. #6
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    I read it as alternate background, except on project instead of record.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  7. #7
    orange's Avatar
    orange is online now Moderator
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,722
    I read it as Paul did, but the sample graphic the OP provided didn't clarify the request.

  8. #8
    tuniwes is offline Advanced Beginner
    Windows 8 Access 2013
    Join Date
    Nov 2015
    Posts
    43
    Quote Originally Posted by orange View Post
    I read it as Paul did, but the sample graphic the OP provided didn't clarify the request.
    Sorry guys, been away from the PC a couple days, Thanks for your replies

    As I see it the alternate background normally changes every other record in the detail section
    I only want it to change when the project changes. I can add a project grouping and use a very thin header to create a line break but this will not as far as I can see help in changing the back ground at detail level.
    There could be over 50 projects on the go at any time with new ones constantly being added. Some might have up to 300 lines under one project but on the other hand could only be one or two

    I think the only solution is via VBA but I can't figure out how to do it

    Thanks

    Ian

  9. #9
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Post 2 has a rough outline. If you want to attach a sample db to play with, I'll code it.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  10. #10
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,778
    I have no idea what "when the project field changes" means. Any time after the form opens? Only if it is altered from the original value? The former may require code via .OldValue property but the latter is merely conditional formatting IMHO - as long as there is a T/F field to flag a change. Grouping by "changed" was also mentioned. Hard to do without a flag field methinks, unless maybe this has a different meaning from what one would usually think.

  11. #11
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    I think it "changes" when it's different from the record above.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  12. #12
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,778
    Maybe. Working right to left because the header labels don't line up, I see Project as either TILE300 or 31305 for the rows that have highlighting yet neither Item or Customer information is the same for either record, so what would be the common thing between them? I guess I will leave this to those who seem to be able to decipher the information.

  13. #13
    tuniwes is offline Advanced Beginner
    Windows 8 Access 2013
    Join Date
    Nov 2015
    Posts
    43

    Post

    Ok, I have lined up the field headers.sorry about that I have tried to upload a cut down version of the database but get an error message "File upload failed"...not clear why this is

    So from the top, what I am trying to do is have :

    Project Detail Colour

    Apollo Park White Background
    All King William Street lines Alternate Backround say Light Grey
    All SP Arndale lines White Backround

    with the background colour alternating on each change of project name

    Etc,etc

    Thanks

    Ian

    Click image for larger version. 

Name:	example.JPG 
Views:	21 
Size:	277.9 KB 
ID:	33345

  14. #14
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    You should be able to attach after doing a compact/repair and then zipping.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  15. #15
    tuniwes is offline Advanced Beginner
    Windows 8 Access 2013
    Join Date
    Nov 2015
    Posts
    43
    Quote Originally Posted by pbaldy View Post
    You should be able to attach after doing a compact/repair and then zipping.

    Thanks, I think that worked

    example.zip

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

Similar Threads

  1. Replies: 3
    Last Post: 12-15-2016, 04:02 PM
  2. Replies: 3
    Last Post: 08-22-2016, 08:02 AM
  3. Replies: 2
    Last Post: 01-09-2014, 07:24 PM
  4. Replies: 6
    Last Post: 03-26-2013, 12:17 PM
  5. Replies: 0
    Last Post: 03-25-2011, 03:35 PM

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