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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How can I make combo box display my options listed below?

Status
Not open for further replies.

lebanoncedars

Programmer
Jul 17, 2002
43
CA
Hi there,
this is my code listed below for colors for each time I choose an option in my combo box.
So I have:
- Form called "Customer datasheet"
- combo box called "Status"
- Text field called "text0"

What I want to do : is each time i choose one of the options in my combo box, the colors has to change as I set it below and I need the "text0" to display the same option
in the combo box.
this is my code color works well except (texto doesn't display the same words as the combo box).

Private Sub Status_Click()
Select Case Status
Case "To be Dispatched" 'Order to be dispatched
Status.ForeColor = vbBlack
text0.BackColor = vbYellow
text0.ForeColor = vbBlack
Case "Dispatched" 'Order Dispatched
Status.ForeColor = vbBlack
text0.BackColor = vbGreen
text0.ForeColor = vbBlack
Case "Cleared" 'Order cleared
Status.ForeColor = vbBlack
text0.BackColor = vbCyan
text0.ForeColor = vbBlack
Case "Invoiced" 'Order invoiced
Status.ForeColor = vbBlack
text0.BackColor = vbBlue
text0.ForeColor = vbBlack
Case Else
Status.ForeColor = vbWhite
text0.ForeColor = vbWhite
End Select

End Sub


HELP PLEASE, IF ANYONE KNOWS HOW?
DETAILS IF POSSIBEL.
THANKS
Lebanoncedars
 
What you need is :-

Code:
Private Sub Status_Click()

Status.ForeColor = vbBlack
text0.ForeColor = vbBlack
text0 = Status
Select Case Status
        Case "To be Dispatched" 'Order to be dispatched
            text0.BackColor = vbYellow
        Case "Dispatched" 'Order Dispatched
            text0.BackColor = vbGreen
        Case "Cleared" 'Order cleared
            text0.BackColor = vbCyan
        Case "Invoiced" 'Order invoiced
            text0.BackColor = vbBlue
    Case Else
    Status.ForeColor = vbWhite
    text0.ForeColor = vbWhite
End Select

End Sub


'ope-that-'elps.

G LS
 
Hi LittleSmudge,
You probably right about your code. Instead I had to impliment in each case something like that:
Me.text0 = "To be dispatched"

But the problem is I have a continous Form and all the text0 field changes the color alright. but it changes the color in every record.
I want it to go ONLY to a specific record.
Means only I need to apply it to one record.
How can I do that please?

Thanks
Lebanoncedars
 
If text0 is not BOUND to a field in the table that underlies your form then you cannot do it.

This is because unbound objects are just repeated instances of a single object. Only where the object is bound to a field do you have any way of differentating which record you are refering to.

G LS
 
Hi,
Thanks for replying.
each record has a customer ID and text0 field.
so I need on my continous form to turn the color on that text0 for ONLY the record or that customer ID.

I hope U know what I mean.

Thanks again
lebanoncedars
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top