Combo Box Font Color

J

JK

I have asked this question before and had no takers :-(

Example:

Combo is base on a query which in turn based on a table eg:

tblCountries:
Country_ID (key)
Country (text) eg: "Australia"
ShortName (Text) eg: "Aus"
etc.

qryCountries:
SELECT Country,SHORTNAME,Country_ID FROM tblCountries

Combo:
SELECT SHORTNAME, Country,Country_ID FROM qryCountries

(Upper case is only for emphasis here)
(Please note "ShortName" is the *second* column in the query)

When I specify the "ForeColor" of the combo box to ,say, vbBlue, the colour
does *not *change (no errors).
HOWEVER, if I change Column(0) in the Combo to "Country" - no problems.

Sure, I can duplicate the query changing the first field of the *query* to
Column(0) of the combo box. I am trying to avoid it as this will entail
duplication of quite a few queries.

I hope that explained it better.

Any suggestions? (including "no can do")

Regards/JK
 
G

Guest

Hi JK,

A couple of questions for you first.
1. Why base the combo on the query, why not base it on the table?
2. How are you specifying the forecolour - VBA? If so, on what event?
3. Would you be better using conditional formatting?

If you are wanting to change the forecolour based on the value of the
selection in the combo, have a look at using conditional formatting or set it
via VBA on the change event.
If you are setting the value via VBA then please post the code.

Regards,

Nick.
 
J

JK

Hi Nick,

Thanks for taking the time to reply.
Please read below:

Biz Enhancer said:
Hi JK,

A couple of questions for you first.
1. Why base the combo on the query, why not base it on the table?

No particular reason, other than habit, I guess. I have the queries for
other purposes - I can change the base of the combos and see whether that
will produce the deisred result (I can't reemember whether I ever tried to
solve the problem in this way)
2. How are you specifying the forecolour - VBA? If so, on what event?

Both VBA and using the Combo properties prduces the same resluts. The
Evnt is AfterUpdate of an Option Group (see blow), or OnOpen (Form).

3. Would you be better using conditional formatting?

If you are wanting to change the forecolour based on the value of the
selection in the combo, have a look at using conditional formatting or set
it
via VBA on the change event.
If you are setting the value via VBA then please post the code.

Every form has 2 modes which are controlled by Option Buttons

1.Edit Mode: User can edit/Add/Delete, using the With Statement:

(For each Field on the form)

With Me.MyField
.Locked=False
.Enabled=True
.ForeColor=vbBlack
End With

(Edit Button is hidden from users without appropriate authority)

2. View Mode: User can only view the form

With Me.MyField
.Locked=True
.Enabled=False
.ForeColor=vbBlue
End With



Regards
Jacob
 
J

JK

Hi Nick,

Basing the combo box on a table rather than on a query does the trick :)

Many thanks for your suggestion.

Regards
Jacob
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top