Results 1 to 9 of 9
  1. #1
    GraeagleBill's Avatar
    GraeagleBill is offline Experienced Old Geezer
    Windows 7 64bit Access 2003
    Join Date
    Feb 2011
    Posts
    1,919

    Change background color on all TB's on any selected record in a continuous form

    On a continuous form, I have set conditional formatting on each TB to change the background color when the TB gets the focus. Is there a way to change the background colors on ALL TB's when a given record gets the focus?



    Would it work to have a general module toggle the background color when a record gets/looses the focus via a click on the record selector?

  2. #2
    GraeagleBill's Avatar
    GraeagleBill is offline Experienced Old Geezer
    Windows 7 64bit Access 2003
    Join Date
    Feb 2011
    Posts
    1,919
    Would it work to have a general module toggle the background color when a record gets/looses the focus via a click on the record selector?

    NO, it changes for all records

  3. #3
    Micron is offline Virtually Inert Person
    Windows 7 32bit Access 2007
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,801
    But you can make the textboxes transparent and lay a rectangle below the whole row and format the background colour of the rectangle. This will only affect one row. However, you may not arrive at a design look that you're happy with since the area between controls will also get coloured. I suppose you could put one behind each control, set their tags to "ColourMe" and loop through those tagged controls when one of the controls receives the focus. Sounds like a lot of work for some fancy backlighting effects. I've only done it behind one control on a datasheet to hightlight who is logged in.

  4. #4
    GraeagleBill's Avatar
    GraeagleBill is offline Experienced Old Geezer
    Windows 7 64bit Access 2003
    Join Date
    Feb 2011
    Posts
    1,919
    By "loop through" do you mean to loop through the controls collection looking for Me.MyRecControls.tag = "ColourMe"?

  5. #5
    Micron is offline Virtually Inert Person
    Windows 7 32bit Access 2007
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,801
    Yes, although you should allow for controls you may have, or could later have, that don't have the tag property. I just use On Error Resume Next inside of the For Each block and reset it to the errorHandler at the end of the loop if necessary. Or you could use an IF block to test for the control type and nest the For Each loop inside of that. A wee bit more cumbersome if the controls are not all the same type. I see no reason why you could not do this when a control gets the focus, but as I said, I only did it by referencing one control in the record. If it was true, the rectangle was yellow. Made it look like the overlaid control was yellow.
    "Sounds like a lot of work for some fancy backlighting effects." I said this because each control in the row would have to call this routine, which would be its own sub rather than repeat the formatting code in each. If you want to go nuts, add a second parameter to the tag (colourme;vbaRed) and find the value of the rest of the string after the ; and apply that as the colour. Maybe you could make a tartan design!
    OK, now I'm getting carried away - time to drink more beer!

  6. #6
    GraeagleBill's Avatar
    GraeagleBill is offline Experienced Old Geezer
    Windows 7 64bit Access 2003
    Join Date
    Feb 2011
    Posts
    1,919
    A lot of fun suggestions. I'll play with all the ideas over the weekend. Taking a variation of one of your thoughts is to put a transparent rectangle "behind" all the controls and toggle it's color leaving the controls with background colors unchanged. I think that would give sufficient attention to the record.
    Bill

  7. #7
    Micron is offline Virtually Inert Person
    Windows 7 32bit Access 2007
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,801
    Ya got me...I didn't mention that the rectangle was transparent too.
    "make the textboxes transparent and lay a rectangle below the whole row"

    Saw your (I think) mis-placed post on how to arrange the order...
    Right click > Position > Send to back. Can't recall how that was done from a menu in your 2003 version. It's on the Arrange tab of the ribbon in 2007.

  8. #8
    GraeagleBill's Avatar
    GraeagleBill is offline Experienced Old Geezer
    Windows 7 64bit Access 2003
    Join Date
    Feb 2011
    Posts
    1,919
    Too bad I can't have conditional formatting on a rectangle. Oh well

    The Detail section of the form is comprised of two rows where the first row is has TB's end-to-end with a two grid gap. I laid a rectangle "behind" just the top row with light color that helps to distinguish one record from the next. I'll leave it at that for now while I resume development of the more important parts of the app.

    Thanks for your thoughts and ideas.

    Bill

  9. #9
    Micron is offline Virtually Inert Person
    Windows 7 32bit Access 2007
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,801
    Your're welcome.
    Too bad I can't have conditional formatting on a rectangle. Oh well
    Maybe an unbound textbox with the same design properties?

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 4
    Last Post: 08-29-2015, 07:38 AM
  2. Replies: 4
    Last Post: 10-28-2014, 09:51 AM
  3. Replies: 2
    Last Post: 06-01-2014, 12:05 PM
  4. Replies: 3
    Last Post: 01-01-2014, 11:21 PM
  5. Change Row Background Color Programmatically
    By sales@4bco.com in forum Programming
    Replies: 2
    Last Post: 10-25-2009, 11:17 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