Office中国论坛/Access中国论坛

标题: 如何设定表中某个字段只读,其余字段读写? 谢 [打印本页]

作者: irfhzk    时间: 2016-4-19 15:37
标题: 如何设定表中某个字段只读,其余字段读写? 谢
如题, 在窗体中可以实现。 但在表中如何设定某个字段只读,其余字段读写? 请大神解答。 多谢。
作者: roych    时间: 2016-4-19 16:18
1、如果使用工作组的话,可以设置表数据的增删改查权限。但数据表不提供这样的属性。
2、出于数据安全性的考虑,一般不会让用户直接使用数据表来对记录进行操作,而是通过窗体为媒介来完成用户交互过程。
3、事实上,所有数据库都没有这样的功能。
作者: irfhzk    时间: 2016-4-19 16:26
roych 发表于 2016-4-19 16:18
1、如果使用工作组的话,可以设置表数据的增删改查权限。但数据表不提供这样的属性。
2、出于数据安全性的 ...

谢谢 建议, 我找到方法了。 目前实现1,2列只读, 3~8列读写:
Once the data has been entered:
1. Open the table in design view.

2. Open the Properties box (View menu).

3. Beside the table's Validation Rule in the Properties box (not the
Validation Rule in the lower pane of the table design window, which applies
to a field), enter:
False

4. Save, answering No to the question about testing existing data.

The Validation Rule is an expression that evaluates to True or False. Since
this expression is always false, Access won't allow any entries or
alterations. You will need to prevent deletions in the form (set
AllowDeletions to No.)

If you need to do this programmatically, CreateProperty() on the TableDef().

Of course, full-blown Access security is the more comprehensive solution.
作者: roych    时间: 2016-4-19 17:05
irfhzk 发表于 2016-4-19 16:26
谢谢 建议, 我找到方法了。 目前实现1,2列只读, 3~8列读写:
Once the data has been entered:
1. Op ...

太复杂。那两列一直留空?如果需要录入数据时怎么办?
为此用createProperty方法来创建属性?这并不比在窗体实现容易吧?




欢迎光临 Office中国论坛/Access中国论坛 (http://www.office-cn.net/) Powered by Discuz! X3.3