database 如何通过表单向 Ms Access 中的表添加新记录?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3980910/
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
How to add new record to table in Ms Access by form?
提问by kspacja
I made form by wizard, but when I run this, first I have in fields first record from table, and I can edit this record, but I don't want to have this. I want to have blank field and when I click add button i can add new record, not edit....
我通过向导制作了表单,但是当我运行它时,首先我在字段中拥有表中的第一条记录,我可以编辑此记录,但我不想拥有它。我想要空白字段,当我点击添加按钮时,我可以添加新记录,而不是编辑....
回答by Patrick Honorez
Change the form's properties:
更改表单的属性:
AllowEdit = False
to prevent changing existing records
and/orDataEntry = True
to arrive on the New Record whenever the user opens the form.
AllowEdit = False
以防止在用户打开表单时更改现有记录
和/或DataEntry = True
到达新记录。
回答by Wafa
Create a macro for this. 1. In create tab select macro. 2. Under cation field in macro select open form. 3. Below in property box select the form you want to perform task with 4. Then in Data Mode select Add.
为此创建一个宏。1. 在创建选项卡中选择宏。2. 在macro 中的cation 字段下选择open form。3. 在属性框下方选择要执行任务的表单 4. 然后在数据模式中选择添加。
Then when ever you run this Macro your form will open to enter a new record and not editing existing record.
然后,当您运行此宏时,您的表单将打开以输入新记录而不是编辑现有记录。
The only problem here would be when you open form then it will open in edit existing record mode but when you open corresponding macro form will open in add mode, so in order to counter this you can name your Macro as AutoExec so the macro will run itself when you open the database.;
这里唯一的问题是,当您打开表单时,它将以编辑现有记录模式打开,但是当您打开相应的宏表单时,它将以添加模式打开,因此为了解决这个问题,您可以将宏命名为 AutoExec,以便宏将运行当你打开数据库时它自己。