表单不会保存对表的编辑 [英] Forms won't save edits to table

查看:64
本文介绍了表单不会保存对表的编辑的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个表单使用未绑定的文本框来自动填充其他文本框,方法是使用组合框并在vba中使用以下代码:me.name.value = me.ID.column(0)


所以你输入一个ID并自动填充名称,网站等其他方框。


当我选择一个ID并自动填充这些框时,我想成为如果我需要动态更改和更新ID,我们可以编辑这些框。


Forms属性将记录源作为此信息在查询构建器上的唯一表。我可以使用查询更新表,但不能通过在表单上进行编辑来更新表。数据输入=否,允许添加=是,允许删除=是,允许编辑=是。将要编辑的框未锁定并且已启用,并且已从表中限定为源。

I have a form that uses an unbound text box to autofill other text boxes by using the combo box and using the following code in vba: me.name.value = me.ID.column(0)

So you type in a ID and autofills other boxes like name, site, etc.

when I choose an ID and autofills these boxes, I want to be able to edit these boxes if I need to change and update an ID on the fly.

The Forms properties has record source as the only table where this information is on query builder. I am able to update the table by using the query but not update the table by editing on the form. Data Entry = No, Allow Additions = Yes, Allow Deletions = Yes, Allow Edits = Yes. The box that will be edited are not locked and are enabled and is bounded to the source from the table.

推荐答案

需要更多详细信息。

您的表单的RecordSource是什么?

您的组合框的RowSource是什么?


请发送您的关系窗格的图片显示表格中的所有字段。


读取保留字。在您的情况下名称不好。

Me.Name实际上是当前表单的名称。如果您在从表单运行某些内容时中断代码并键入Print Me.Name在即时窗口中,您将看到表单的名称。我不知道Me.Name.Value会产生什么。


其他经常被误用的保留字包括Date,但是你可以找到它们的完整列表。


如果你真的坚持使用名字,你必须使用我![姓名]


Phil
Need a bot more detail on this.
What is the RecordSource of your form?
What is the RowSource of your Combo Box?

Please send a picture of your Relationship Pane with all the fields in your tables showing.

Read up on reserved words. In your case Name is not good.
Me.Name is actually the name of the current form. If you break the code when running something from a form and type "Print Me.Name" in the immediate window, you will see the name of your form. I have no idea what Me.Name.Value will produce.

Other frequently misused reserved words include "Date", but there is a whole list of them that you can find.

If you really insist on using "Name", you must use Me![Name]

Phil


我有一个表单,使用未绑定的文本框通过使用组合框自动填充其他文本框并在vba中使用以下代码:me.name.value = me.ID.column(0)


所以你在未绑定的组合框中键入一个ID,并自动填充其他框,如项目,网站等。


当我选择ID和自动填充时其他方块,如果我需要更新ID的属性,我希望能够编辑这些方框。这些自动填充的文本框与Control Source中的表绑定到特定属性。因此,文本框项目受限于表项目属性。


我希望能够通过表单编辑表格,所以我不必去桌子或查询并向右滚动以进行更改。


Forms属性将Record Source作为表格All P,其中此信息位于查询构建器上。我可以使用查询生成器更新表,但无法通过在表单上进行编辑来更新表。属性表单是数据输入=否,允许添加=是,允许删除=是,允许编辑=是。将被编辑的框未锁定并且已启用并且与表中的源有关。


表名为ALL P,查询构建器sql代码如下所示为未绑定组合框行源


SELECT [All P] .ID,[All P] .Project,[All P]。[Site ID],[All

P] .EngineeringRegion,[All P]。[工程市场],[全部P]。活跃,

[全部P]。[播出时间],[全部P]。注意来自[全部] P] ORDER BY [All P] .ID

DESC;

该组合框的事件在更新后,vba代码为

Me.Project.Value = Me.ID.Column(1)

Me.Site_ID.Value = Me.ID.Column(2)

Me .EngineeringRegion.Value = Me.ID.Column(3)

Me.Engineering_Market.Value = Me.ID.Column(4)

Me.Active.Value = Me .ID.Column(5)

Me.On_Air.Value = Me.ID.Column(6)

Me.Notes.Value = Me.ID.Column(7 )
I have a form that uses an unbound text box to autofill other text boxes by using a combo box and using the following code in vba: me.name.value = me.ID.column(0)

So you type in a ID in the unbound combo box and that autofills other boxes like project, site, etc.

When I choose an ID and autofills other boxes, I want to be able to edit these boxes if I need to update an ID''s attributes. These autofilled textboxes are bounded to the table in Control Source to the specific attribute. So the text box project is bounded to the table project attribute.

I want to be able to edit the table through a form so I don''t have to go to the table or a query and scroll all the way to the right to make a change.

The Forms properties has Record Source as the table All P where this information is on query builder. I am able to update the table by using the query builder but not able to update the table by editing on the form. Property Form is Data Entry = No, Allow Additions = Yes, Allow Deletions = Yes, Allow Edits = Yes. The box that will be edited are not locked and are enabled and is bounded to the source from the table.

Table name is ALL P and the query builder sql code is below for the unbound combo box Row Source

SELECT [All P].ID, [All P].Project, [All P].[Site ID], [All
P].EngineeringRegion, [All P].[Engineering Market], [All P].Active,
[All P].[On Air], [All P].Notes FROM [All P] ORDER BY [All P].ID
DESC;
The event of that combo box is in After update and the vba code is

Me.Project.Value = Me.ID.Column(1)
Me.Site_ID.Value = Me.ID.Column(2)
Me.EngineeringRegion.Value = Me.ID.Column(3)
Me.Engineering_Market.Value = Me.ID.Column(4)
Me.Active.Value = Me.ID.Column(5)
Me.On_Air.Value = Me.ID.Column(6)
Me.Notes.Value = Me.ID.Column(7)


让我们尝试解决这个问题。


表单上的控件绑定到ALL P表,因此当您浏览记录时,您将获得可以更新的值。


Th Combo Box是基于完全相同的信息,所以你是否想要用从组合框中选择的另一条记录覆盖现有记录?然后你将有2个相同的记录,除了ID。


或者你是说你想创建一个新记录并从组合框中设置默认值?


我很困惑,坐得最少。


Phil
Let''s try to work this out.

The controls on the form are bound to the ALL P Table, so as you go through the records, you will get the values which you can update.

Th Combo Box is based on exactly the same information, so are you saying you want to overwrite an existing record with another record selected from your combo box? Then you will have 2 identical records except for the ID.

Or are you saying you want to create a new record and set the default values from the Combo box?

I am confused to sat the least.

Phil


这篇关于表单不会保存对表的编辑的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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