如何锁定备注字段? [英] How To Lock Memo field?

查看:125
本文介绍了如何锁定备注字段?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个备忘录字段被指定为表格上的评论....我将如何进行锁定?该字段使得一个用户写的笔记以后不能被另一个用户修改?换句话说,一个人可以添加到评论字段并阅读过去的评论,但一旦更新,该字段中包含的注释就无法修改或删除,只会添加到。

解决方案

秘诀是不让用户直接访问备忘录字段。相反,您让他们将数据输入到未绑定的文本框中,然后将其添加到备注字段中的当前数据。


命令按钮=输入数据

未绑定文本框= YourMemoFieldInput

您的备注字段= YourMemoField


在设计视图中


选择YourMemoFieldInput,然后转到属性 - 格式和设置可见为假


选择YourMemoField,然后转到属性 - 数据并设置锁定为真


选择InputData命令按钮,转到属性 - 格式化并将其标题设置为输入新注释 (请不要使用引号)


现在,在'代码窗口的窗体中:

展开 | 选择 | 换行 | 行号



秘诀是不让用户直接访问备忘录字段。相反,您让他们将数据输入到未绑定的文本框中,然后将其添加到备注字段中的当前数据。


命令按钮=输入数据

未绑定文本框= YourMemoFieldInput

您的备注字段= YourMemoField


在设计视图中


选择YourMemoFieldInput,然后转到属性 - 格式和设置可见为假


选择YourMemoField,然后转到属性 - 数据并设置锁定为真


选择InputData命令按钮,转到属性 - 格式化并将其标题设置为输入新注释 (请不要使用引号)


现在,在'代码窗口的窗体中:

展开 | 选择 | 换行 | 行号


好。由于 YourMemoFieldInput 是一个未绑定的控件,因此您不能像修改时那样将其称为 Me!YourMemoFieldInput 。此外,如果你没有限制拼写检查到这个未绑定的字段,它会尝试检查备注字段,并且一些goofus将尝试更改锁定字段中的某些内容,并且你会收到错误,所以你需要将拼写检查限制为单个字段。您可以通过选择要检查的文本来完成此操作。这就是线条


YourMemoFieldInput.SelStart = 1

YourMemoFieldInput.SelLength = Len(YourMemoFieldInput.Value)


。我还注意到,我们没有在添加每个音符组之间放置空格,所以我修改了它。这个新代码应该做你需要的,包括你的拼写检查!

展开 | 选择 | Wrap | 行号


I have a memo field designated as comments on a form....How would I go about "locking" the field so that the notes written by one user could not be modified at a later point by another?? In other words, a person could add to the comments field and read past comments, but once updated, the notes contained in the field could not be modified or deleted, only added to.

解决方案

The secret is to not give the users direct access to the memo field. Instead , you have them enter data into an unbound textbox, then add it to the current data in the memo field.

Command Button = InputData
Unbound Textbox = YourMemoFieldInput
Your Memo Field = YourMemoField

In Design View

Select YourMemoFieldInput, then goto Properties -- Format and set Visible to False

Select YourMemoField, then goto Properties -- Data and set Locked to True

Select the InputData command button and goto Properties -- Format and set its Caption to "Input New Notes" (leave off the quotes)

Now, in the form''s code window:

Expand|Select|Wrap|Line Numbers


The secret is to not give the users direct access to the memo field. Instead , you have them enter data into an unbound textbox, then add it to the current data in the memo field.

Command Button = InputData
Unbound Textbox = YourMemoFieldInput
Your Memo Field = YourMemoField

In Design View

Select YourMemoFieldInput, then goto Properties -- Format and set Visible to False

Select YourMemoField, then goto Properties -- Data and set Locked to True

Select the InputData command button and goto Properties -- Format and set its Caption to "Input New Notes" (leave off the quotes)

Now, in the form''s code window:

Expand|Select|Wrap|Line Numbers


Okay. Since YourMemoFieldInput is an unbound control, you can''t refer to it as Me!YourMemoFieldInput as you did in your modification. Also, if you don''t limit the spellcheck to this unbound field, it''ll try to check the memo field, and some goofus will try to change something in the locked field, and you''ll get an error, so you need to limit the spellcheck to the single field. You do this by selecting text that you want checked. That''s what the lines

YourMemoFieldInput.SelStart = 1
YourMemoFieldInput.SelLength = Len(YourMemoFieldInput.Value)

do. I also noticed that we didn''t place a space between each set of notes as they''re added, so I modified that. This new code should do what you need, including your spell check!

Expand|Select|Wrap|Line Numbers


这篇关于如何锁定备注字段?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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