Changing textbox color by entering color name

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Josephbupe
    New Member
    • Jan 2008
    • 7

    Changing textbox color by entering color name

    Hello everyone.

    I would like to have a text box with a code that would allow changing text color depending on the name of the colour. For instance, if i type in "GREEN" the colour of text GREEN should be in green, and if i type in "BLUE" the text should be in the colour blue.

    I want this to be done with RED, ORANGE, YELLOW, BLUE, GREEN and BLACK.

    How can i do it.
  • Delerna
    Recognized Expert Top Contributor
    • Jan 2008
    • 1134

    #2
    take a look at vbRed in access help

    In the Change event for the textbox is where you will put the code
    You will change the forecolor property

    something like this
    [code=vb]
    Private Sub Text2_Change()
    Select Case Text2
    Case "Red": Text2.ForeColor = vbRed
    Case "Black": Text2.ForeColor = vbBlack
    End Select
    End Sub
    [/code]

    Comment

    • Stewart Ross
      Recognized Expert Moderator Specialist
      • Feb 2008
      • 2545

      #3
      Hi Joseph. I have changed the title of your thread from "To" to the title you now see above. It helps all our users if a thread is given a meaningful title, and I am sure you will understand that "To" was not suitable. I am sure this was just a mistake on your part.

      MODERATOR

      Comment

      Working...