Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using a drop down list to select background colour

Status
Not open for further replies.

kpryan

Technical User
Aug 24, 2005
282
US
Hi all,

Is it possible to have a drop down list box or combo box so that I can select a colour to fill a text box background?

I know I can use conditional formatting to do this but, wanted to know if this is possible


Many thanks,

KP
 
If you mean can you have a list with each line a different colour, the answer is no, you can, however, list colours by name and update the background to the colour selected, use a listview control, or use a 'colour-picker' pop-up form. I went with the pop-up when I wanted to do this.
 
if you just want to change the colour of a text box background after you select a colour from a list, or even a value from a list

combo box,
name combo1
column count: 2,
widths: 0cm;3cm
Row Source Type: Value List
Row Source: 16777215;WHITE;16711808;blue;8421376;green

create code for after update on combo1
Private Sub Combo0_AfterUpdate()
If Not IsNull(Me.Combo0) And Me.Combo0 <> "" Then
Me.Text2.BackColor = Me.Combo0
End If
End Sub

is that what you mean or was it the list thing??

cheers

daveJam

even my shrink says its all your f#@/ing fault
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top