PC Review


Reply
Thread Tools Rate Thread

Combo Box Font Color

 
 
JK
Guest
Posts: n/a
 
      14th Nov 2006
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











 
Reply With Quote
 
 
 
 
=?Utf-8?B?Qml6IEVuaGFuY2Vy?=
Guest
Posts: n/a
 
      14th Nov 2006
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.
"JK" wrote:

> 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
>
>
>
>
>
>
>
>
>
>
>
>

 
Reply With Quote
 
JK
Guest
Posts: n/a
 
      15th Nov 2006
Hi Nick,

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

"Biz Enhancer" <(E-Mail Removed)> wrote in message
news:C0C97158-BC3C-4DD0-A5CB-(E-Mail Removed)...
> 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

>
> Regards,
>
> Nick.
> "JK" wrote:
>
>> 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
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>




 
Reply With Quote
 
JK
Guest
Posts: n/a
 
      15th Nov 2006
Hi Nick,

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

Many thanks for your suggestion.

Regards
Jacob


"Biz Enhancer" <(E-Mail Removed)> wrote in message
news:C0C97158-BC3C-4DD0-A5CB-(E-Mail Removed)...
> 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.
> "JK" wrote:
>
>> 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
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Variable Font Color in Combo Box Jon M. Microsoft Access Form Coding 1 11th May 2009 05:26 PM
font color in combo box Chris Microsoft Access 0 17th Oct 2008 02:03 PM
Change color font and background combo box stef Microsoft Excel Discussion 4 11th Jun 2008 05:13 AM
Combo Box font color JK Microsoft Access 0 25th Sep 2006 05:55 AM
Combo Box font color =?Utf-8?B?UGhpbCBIYWdlbWFu?= Microsoft Excel Programming 3 13th Apr 2004 06:41 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:46 PM.