条件格式化 [英] Contingent formatting

查看:74
本文介绍了条件格式化的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问题:


在记录之间移动时,我需要控制哪些组合/文本框

显示在当前表单上,具体取决于数据当前

记录。


更多:


我建立了我的第一个访问数据库。


记录条目是单个表格,表格包含许多

或有组合框,文本框等的情况。


在构建表单时,我只测试表单本身的

单个记录,而不是在记录之间移动。一切正常,所以

,因为你不在记录之间移动。


然而,当我在记录之间移动时,格式化(即。

组合/文本框可见/已启用)保持原样,最近手动输入的记录为最近的



一个简单的方法地址这将是一个''OnChangeRecord''类型

事件,它检测按下MS Access默认记录控件

,它出现在屏幕的左下角。这可能吗?如果是这样,

如何?


对于我的表单格式,我已经使用了_Change事件来组合框。

哪里应该这种格式化,当用户在记录之间移动时,需要在何处正确更新




我已经尝试过Form_AfterUpdate事件而没有成功。

非常感谢任何帮助。

解决方案

每当用户移动时,表格的当前事件就会触发记录。


组合的Change事件会在每次击键时触发,因此请使用其

AfterUpdate事件来响应值的变化。


如果你有很多需要隐藏/显示的控件,你可能需要

a不同的数据结构,其中你保存的一些属性

成为相关表中的值而不是一个大表的字段。


如果表单在C中,则无法有条件地隐藏列ontinuous或

数据表视图。


-

Allen Browne - 微软MVP。西澳大利亚州珀斯。

访问用户提示 - http:// allenbrowne.com/tips.html

回复群组,而不是mvps dot org的allenbrowne。


" dmieluk" < DM ***** @ exemail.com.au>在消息中写道

news:11 ********************** @ f14g2000cwb.googlegr oups.com ...

问题:

当在记录之间移动时,我需要控制当前表单上显示哪些组合/文本框
,具体取决于当前
记录中的数据。

更多:

我建立了我的第一个访问数据库。

记录条目是一个表单,表单包含许多<

构建表单时,我只测试表单本身的单个记录,而不是在记录之间移动。一切正常,所以
只要你不在记录之间移动。

然而,当我在记录之间移动时,格式化(即。
组合/文本框是可见的/启用)仍然是最近手动输入的记录。

解决这个问题的一个简单方法是使用''OnChangeRecord''类型
事件来检测按下显示在屏幕左下角的MS Access默认记录控件。这可能吗?如果是这样,
如何?

对于我的表单格式,我已经使用了_Change事件来组合框。
这种格式应该在哪里,以及它需要在哪里每当用户在记录之间移动时,都能正确更新

我已经尝试过Form_AfterUpdate事件而没有成功。
任何帮助都非常感谢。



感谢您的快速回复。

只要用户移动记录,表格的当前事件就会触发。




在表单视图中,Access提供默认记录选择按钮。是

当用户使用这些

按钮更改记录时,当前事件应该触发吗?我将此代码添加到我的表单中:


私人子表单_当前()


哔声


结束Sub


当我使用提供的

按钮更改记录时,我听不到哔声。


By相比之下,当我将beep命令添加到其中一个

我的现有组合框更改事件(当我更改该组合框时)时,我确实听到了哔声。


是:Form_Current使用内置导航触发。按钮。


替换

beep

with

Debug.Print"更改记录 ; &安培;现在()


打开立即窗口(Ctrl + G)并观察输出。


-

Allen Browne - 微软MVP。西澳大利亚州珀斯。

访问用户提示 - http:// allenbrowne.com/tips.html

回复群组,而不是mvps dot org的allenbrowne。


" dmieluk" < DM ***** @ exemail.com.au>在消息中写道

news:11 ********************* @ o13g2000cwo.googlegro ups.com ...

感谢您的快速回复。

只要用户移动记录,就会触发表单的当前事件。



在表单视图中,Access提供默认记录选择按钮。当用户使用这些按钮更改记录时,是否应该触发
当前事件?我把这个代码添加到我的表格中:

私人子表格_当前()

哔哔

结束子

我做当我使用提供的
按钮更改记录时听不到哔声。

相反,当我将beep命令添加到我现有的组合框之一时,我确实听到了嘟嘟声更改事件(当我更改该组合框时)。



Problem:

When moving between records, I need to control which combo/text boxes
are displayed on the current form, dependent upon data in the current
record.

More:

I building my first access database.

Record entry is by a single form, and the form contains many cases of
contingent combo boxes, text boxes, etc.

When building the form, I was testing only the form by itself for a
single record, not moving between records. Everything works fine so
long as you do not move between records.

However, when I move between records, the formatting (ie. which
combo/text boxes are visible/enabled) remains as it was on the most
recent manually entered record.

A simple way to address this would be to have an ''OnChangeRecord'' type
event which detects presses on the MS Access default record controls
which appear at the bottom left of the screen. Is this possible? If so,
how?

For my form formatting, I have used the _Change event for combo boxes.
Where should this formatting go, and where does it need to be to update
correctly whenever a user moves between records?

I have experimented with the Form_AfterUpdate event without success.
Any help greatly appreciated.

解决方案

The Current event of the form fires whenever the user moves record.

The Change event of a combo fires for every keystroke, so use its
AfterUpdate event to respond to a change in value.

If you have lots of controls that need to be hidden/shown, you probably need
a different data structure, where some of the attributes you are saving
become values in a related table rather than fields of the one big table.

You cannot conditionally hide columns if your form is in Continuous or
Datasheet view.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"dmieluk" <dm*****@exemail.com.au> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.com...

Problem:

When moving between records, I need to control which combo/text boxes
are displayed on the current form, dependent upon data in the current
record.

More:

I building my first access database.

Record entry is by a single form, and the form contains many cases of
contingent combo boxes, text boxes, etc.

When building the form, I was testing only the form by itself for a
single record, not moving between records. Everything works fine so
long as you do not move between records.

However, when I move between records, the formatting (ie. which
combo/text boxes are visible/enabled) remains as it was on the most
recent manually entered record.

A simple way to address this would be to have an ''OnChangeRecord'' type
event which detects presses on the MS Access default record controls
which appear at the bottom left of the screen. Is this possible? If so,
how?

For my form formatting, I have used the _Change event for combo boxes.
Where should this formatting go, and where does it need to be to update
correctly whenever a user moves between records?

I have experimented with the Form_AfterUpdate event without success.
Any help greatly appreciated.



Thank you for your quick reply.

The Current event of the form fires whenever the user moves record.



In form view, Access provides default record selection buttons. Is the
Current event supposed to fire when the user changes record using these
buttons? I added this code to my form:

Private Sub Form_Current()

Beep

End Sub

I do not hear the beep when I change records using the provided
buttons.

By contrast, I do hear the beep when I add the beep command to one of
my existing combo box Change events (when I change that combo box).


Yes: Form_Current fires with the built-in nav. buttons.

Replace
beep
with
Debug.Print "Changed record at " & Now()

Open the Immediate Window (Ctrl+G) and watch the output.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"dmieluk" <dm*****@exemail.com.au> wrote in message
news:11*********************@o13g2000cwo.googlegro ups.com...

Thank you for your quick reply.

The Current event of the form fires whenever the user moves record.



In form view, Access provides default record selection buttons. Is the
Current event supposed to fire when the user changes record using these
buttons? I added this code to my form:

Private Sub Form_Current()

Beep

End Sub

I do not hear the beep when I change records using the provided
buttons.

By contrast, I do hear the beep when I add the beep command to one of
my existing combo box Change events (when I change that combo box).



这篇关于条件格式化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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