Free Lessons
Courses
Seminars
TechHelp
Fast Tips
Templates
Topic Index
Forum
ABCD
 
Home   Courses   TechHelp   Forums   Help   Contact   Merch   Join   Order   Logon  
 
Back to Access Forum    Comments List
Upload Images   @Reply   Bookmark    Link   Email   Next Unseen 
What Am I Doing Wrong
Lisa Snider 
       
14 months ago
I am trying to get rid of the black highlight in the field that has focus on my forms.  What I want to do is change the background of the control to a light green, and the text to black.  Where have I gone wrong?

Private Sub Form_GotFocus()
    Dim ctl As Control
    Set ctl = Me.ActiveControl
    If ctl.ControlType = acTextBox Or ctl.ControlType = acComboBox Then
        ctl.BackColor = RGB(144, 238, 144) ' Light Green
        ctl.ForeColor = RGB(0, 0, 0) 'Black text
    End If
End Sub
Lisa Snider OP  @Reply  
       
14 months ago

John Davy  @Reply  
         
14 months ago
Hi Lisa,

Take a look at Richard's video on SelStart and SelLength  https://599cd.com/blog/display-article.asp?ID=3444
I think that will help you.  John
John Davy  @Reply  
         
14 months ago
Did you right click on the control in design mode and change the background color and foreground color?
John Davy  @Reply  
         
14 months ago
Hi Lisa, I made a little demo on 1 field. See Screen Clip  John
John Davy  @Reply  
         
14 months ago

John Davy  @Reply  
         
14 months ago
Hi Lisa, After looking more carefully, I think you could select all fields, use Conditional Formatting to set your background color as you want, OnGotFocus. Then add   Me.Fieldname.SelStart = 0 (your fieldname) to the OnGotFocus of the field. It can be done with a loop and vba but this is without extensive vba.  John   Goodnight!

This thread is now CLOSED. If you wish to comment, start a NEW discussion in Access Forum.
 

Next Unseen

 
New Feature: Comment Live View
 
 

The following is a paid advertisement
Computer Learning Zone is not responsible for any content shown or offers made by these ads.
 

Learn
 
Access - index
Excel - index
Word - index
Windows - index
PowerPoint - index
Photoshop - index
Visual Basic - index
ASP - index
Seminars
More...
Customers
 
Login
My Account
My Courses
Lost Password
Memberships
Student Databases
Change Email
Info
 
Latest News
New Releases
User Forums
Topic Glossary
Tips & Tricks
Search The Site
Code Vault
Collapse Menus
Help
 
Customer Support
Web Site Tour
FAQs
TechHelp
Consulting Services
About
 
Background
Testimonials
Jobs
Affiliate Program
Richard Rost
Free Lessons
Mailing List
PCResale.NET
Order
 
Video Tutorials
Handbooks
Memberships
Learning Connection
Idiot's Guide to Excel
Volume Discounts
Payment Info
Shipping
Terms of Sale
Contact
 
Contact Info
Support Policy
Mailing Address
Phone Number
Fax Number
Course Survey
Email Richard
[email protected]
Blog RSS Feed    YouTube Channel

LinkedIn
Copyright 2026 by Computer Learning Zone, Amicron, and Richard Rost. All Rights Reserved. Current Time: 5/6/2026 3:53:00 PM. PLT: 1s