组合框选择不更新表单绑定字段 [英] Combobox Selection not updating form bound fields

查看:71
本文介绍了组合框选择不更新表单绑定字段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的字节社区,


框架:我使用表单设计创建了一个表单。工具。在表单属性表上,它被添加到记录源表中,该表包含我想要更新/添加的字段。

表格中的字段使用添加在表单中引入现有字段按钮。

在下一步中,为了通过组合框选择填充字段,我添加了一个组合框,其中包含选项根据我在我选择的值中查找表单上的记录组合框。。


问题:选择组合框值后,表单中的字段不会自行更新。


问题:不知道为什么这些字段不会更新吗?


由于Access已经在内部建立了连接,我认为应该有一种在不使用Column属性的情况下实现目标的简洁方法, DlookUp,子表单或记录集代码(我认为实现的方法会更快但不起作用)。


非常感谢您的时间和帮助。


最好的问候

解决方案

''使用向导来解决这个问题。


所以有几个问题。

你的组合框的RowSource是什么绑定列,它们有多少列以及它们有多宽?


您能否告诉我们您表单上所有字段的名称。


Phil


PhilOfWalton,


感谢您的回答。我将在这里放一个表格和表格的样本(以便更容易调试)。

在下一张图片中,我们可以看到我的所有形式的名字:




相对于Combobox /表格,可以在下一张图片中分析细节:




表格有阀门表作为记录源。


谢谢!


好的,您需要一些代码才能使其工作(大多数组合框)查找记录将以相同的方式工作。


您还需要在表单上将一个名为ID的字段绑定到表中的ID。顺便说一下,为了清楚起见,我会重命名表和控制ValveID(Access的默认值是将所有表的第一行命名为ID,这会让人非常困惑。)


转到属性表上的事件选项卡。在更新后,如果您键入一个方括号[,它会将其更改为[事件过程]。

单击此行,3行......将出现在行尾。点击这些。


您现在正在编写代码。

此时会说明

展开 | 选择 | Wrap | 行号

Dear Bytes community,

Framework: I have created a form using the "Form Design" tool. On the form property sheet, it was added to the Record Source the table which contained the fields that I wanted to update/add.
The fields from the table were introduced in the form using the "Add Existing Fields" button.
In the next step, in order to have the fields populated by a combobox selection, I added a combobox with the option "Find a record on my form based on the value I selected in my combobox.".

Problem: After selecting a combobox value, the fields in the form didn''t update themselves.

Question: Any idea why this fields don''t update?

Since Access already have the connections made internally, I think there should be a clenear way of accomplishing the goal without using Column property, DlookUp, subforms or recordset code (I thought the one implemented would be the faster way but it is not working).

Thank you very much in advance for your time and help.

Best regards

解决方案

''Fraid that''s the problem using Wizards.

So several questions.
What is the RowSource of your Combo Box, which is the Bound Column, How many columns and how wide are they?

Can you let us have the names of all the fields on your form.

Phil


PhilOfWalton,

Thank you for your answer. I will put here a sample of the table and form (in order to be easier to debug).
In the next image we can see the names of all fidels of my form:



Relatively to the Combobox/form, it is possible to analyse the details in the next image:



The form has Valves table as record source.

Thank you!


OK, you need a bit of code to get this to work (Most of your Combo boxes to find a record will work the same way).

You also need on your form a field called ID bound to the ID in your table. Incidentally, for clarity, I would rename both the table and control ValveID (The default of Access is to name the first line of all your tables "ID", and it gets very confusing.)

Go to the Event Tab on the Property Sheet. On the After Update , if you type a square bracket [, it will change this to [Event Procedure].
Click on this line and 3 dots ... will appear at the end of the line. Click on these.

You are now writing code.
It will say at this point

Expand|Select|Wrap|Line Numbers


这篇关于组合框选择不更新表单绑定字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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