如何根据条件更改组合框中的字体颜色 [英] how to change font color in combo box based on criteria

查看:130
本文介绍了如何根据条件更改组合框中的字体颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨专家,


你能帮我解决这个问题吗?我正在使用Access 2003,我有一个带有组合框的表单,其中包含客户订单和状态列表。我需要帮助的是当用户选择状态为C的客户订单时。然后该客户订单的组合框中的字体为红色,否则将保持黑色。

我该怎么做?我尝试使用条件格式但它不会工作。


非常感谢你...

Hi experts,

Could you please help me with this situation? I''m using Access 2003 and I have a form with combo box containing lists of customer orders and status. What I need help on is when users choose customer order with status "C" then the font in the combo box for this customer order is red, else will remain black.
How can I do this? I tried using conditional formatting but it won''t work.

Thank you so much...

推荐答案

你可以使用VBA来实现这一目标。在组合框的BeforeUpdate事件中,输入以下内容:

You can use VBA to accomplish this. In the BeforeUpdate event for the combobox, enter the following:

展开 | 选择 | Wrap | 行号


感谢您的快速回复。


当我尝试使用你的代码时,它并没有很好地工作。当我从我的组合框中选择时,它没有更改值,而是返回到组合框列表中的第一个值,例如,当我选择cust order 11111时,它在组合框上显示了cust order 00000因为00000是列表中的第一个托管订单。我错过了什么吗?
Thank you for the quick response.

When I tried to put your code, it didn''t work quite well. when I choose from my combo box, it didn''t change the value, instead it went back to the first value on the combo box list, for example, when I choose cust order 11111, it displayed cust order 00000 on the combo box since 00000 is the first cust order on the list. Am I missing something?


你能发布你的代码吗?


这篇关于如何根据条件更改组合框中的字体颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆