vba 如何创建我可以输入的 Access 文本框?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/8974749/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-11 15:00:21  来源:igfitidea点击:

How to create Access textbox that I can just type into?

sqlms-accessvba

提问by maxko87

I need to create a textbox that a user can enter an arbitrary string into. No matter what I try, I always have to link the textbox with a query, table, or something else -- I just want to be able to type anything into a textbox. Is this possible?

我需要创建一个文本框,用户可以在其中输入任意字符串。无论我尝试什么,我总是必须将文本框与查询、表格或其他内容相关联——我只是希望能够在文本框中输入任何内容。这可能吗?

Clarification: I'm using access 2003. Also, I'm talking about the user typing into it, not 'me'. Sorry about the confusion.

说明:我使用的是 access 2003。另外,我指的是用户输入的内容,而不是“我”。很抱歉造成混乱。

回答by Olivier Jacot-Descombes

If your form is data-bound, then the data source must be updatable. Otherwise it will lock the form, including controls that are not data-bound. For instance queries with GROUP BY statements or UNION queries are not updatable.

如果您的表单是数据绑定的,那么数据源必须是可更新的。否则它将锁定窗体,包括非数据绑定的控件。例如,带有 GROUP BY 语句或 UNION 查询的查询不可更新。

If the form is locked or disabled in some way, all controls on that form will be locked or disabled as well.

如果表单以某种方式被锁定或禁用,则该表单上的所有控件也将被锁定或禁用。



EDIT:

编辑:

enter image description here

在此处输入图片说明

AllowEdits is a form property, not a control property.

AllowEdits 是一个表单属性,而不是一个控件属性。

回答by Buck Hicks

You don't mention which version of Access that you are using but every version that i have used up to Access 2007 has a unbound texbox. Try going into design mode on your form. In your title bar you should see something like this that will allow you to enter a textox on your form.

您没有提到您使用的是哪个版本的 Access,但我在 Access 2007 之前使用的每个版本都有一个未绑定的 texbox。尝试在表单上进入设计模式。在您的标题栏中,您应该会看到类似这样的内容,它允许您在表单上输入文本框。

enter image description here

在此处输入图片说明

Once you drag that onto your form you should be able to type anything you want into it. Is that what you were asking or did I misunderstand your question?

将其拖到表单上后,您应该可以在其中键入任何内容。这是你问的问题还是我误解了你的问题?

回答by user2615981

When you create a text box it will say unbound. Leave it saying unbound.

创建文本框时,它会显示未绑定。让它说无约束。