Results 1 to 3 of 3
  1. #1
    mikec is offline Novice
    Windows Vista Access 2007
    Join Date
    Mar 2010
    Posts
    1

    Change the text box color on form load

    I may be asking for more then I am ready for. I have a Continuos form in access, so basically a list. I have one field in the table that is ColorCode and the value is 1, 2, or 3 and on the form the textbox is named txtColor. So on FormLoad, I want access to change the color of that text box to a new color based off the value. Now I think this is how it would look for a standard form:



    Private Sub Form_Load()

    If txtColor.Value = "1" Then txtColor.BackColor = green

    End Sub

    But how can I do this for a continuos form

  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
    Take a look at Conditional Formatting on the ribbon. It would be your simplest solution.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    maximus's Avatar
    maximus is offline Expert
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Aug 2009
    Location
    India
    Posts
    931
    conditional formatting was first introduced in Access 2000 and is probably the best and the easiest way you can solve yours problem. Open your form in design view Click on the control (TextBox) that you want to format, on the main menu bar now go to format and click on conditional formatting and add your criteria.

    Please mark this thread solved if this solves your problem.

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

Similar Threads

  1. Change as per condition font color
    By miziri in forum Programming
    Replies: 1
    Last Post: 08-20-2009, 04:23 AM
  2. Color change in form filed
    By miziri in forum Programming
    Replies: 3
    Last Post: 08-15-2009, 04:53 PM
  3. Color/font change in subform
    By AndyKim in forum Forms
    Replies: 9
    Last Post: 06-24-2009, 04:34 PM
  4. Replies: 1
    Last Post: 03-29-2009, 08:27 AM
  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
  •  
Other Forums: Microsoft Office Forums