Results 1 to 3 of 3

trying to add color to texboxes

  1. #1
    michaelpclisbee is offline Novice
    Windows Vista Access 2007
    Join Date
    Jul 2009
    Posts
    2

    Question trying to add color to texboxes

    On my forms, I want to have the background color on a textbox change when it is selected, then go back to default when you tab to the next textbox. Is there some generic code that will do this? I have up to 20 txtboxes per tab, and dont want to have to add code specifically for each box...


    thanks

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,896
    You would need to put code or a macro in the GotFocus/LostFocus or OnEnter/OnExit events of each control. Hmm...I wonder if creating the control you want and then using it to set your default control would add the code as well. I'll have to give that a try.
    (RG for short) aka Allan Bunch Previous MS Access MVP - WinXP Pro, Win7 Pro Win10 Pro - acXP, ac07, ac10, ac13
    How to mark the thread as Solved!
    Teaching is not filling a bucket but lighting a fire.
    Borrowed quote..."Docendo discimus"

  3. #3
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,896
    OK, a macro does not stay with the default control but it is *real* easy to set the two events of many controls to the same macros. And it is easy to create two macros that work in all of the controls.
    (RG for short) aka Allan Bunch Previous MS Access MVP - WinXP Pro, Win7 Pro Win10 Pro - acXP, ac07, ac10, ac13
    How to mark the thread as Solved!
    Teaching is not filling a bucket but lighting a fire.
    Borrowed quote..."Docendo discimus"

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

Similar Threads

  1. Color/font change in subform
    By AndyKim in forum Forms
    Replies: 9
    Last Post: 06-24-2009, 04:34 PM
  2. Export Report as jpeg (in color)
    By Kupot in forum Reports
    Replies: 1
    Last Post: 05-28-2009, 08:13 PM
  3. background color in a form
    By taggart in forum Forms
    Replies: 1
    Last Post: 05-07-2009, 10:37 AM
  4. Row and colum color editing
    By jerald in forum Database Design
    Replies: 0
    Last Post: 03-18-2009, 05:52 PM
  5. change cell color
    By bishop743 in forum Programming
    Replies: 0
    Last Post: 02-01-2009, 11:00 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
  •  
Tech Forums: Microsoft Office Forums