无法使用列表框选择更新组合框 - 错误2115 [英] Unable to update combo box using list box selection - error 2115

查看:35
本文介绍了无法使用列表框选择更新组合框 - 错误2115的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试根据列表框的选择设置组合框的值。我创建了一个非常简单的通用形式来尝试实现这个目标,但没有成功。表单有一个绑定到查询的列表框,一个按钮和一个绑定到另一个查询的组合框。列表框和组合框的查询是独立的。我可以在表单加载时设置组合框的值(子Form_Load),当我单击按钮(子Command2_Click)时,但是当我在列表框中选择(子List5_AfterUpdate)时,我得到运行时错误2115:设置为此字段的BeforeUpdate或ValidationRule属性的函数宏阻止MS Access在字段中保存日期。我没有设置任何验证规则,这是我的代码的完整列表。

展开 | 选择 | Wrap | 行号

解决方案

组合框中有多少列表成员/行?它会改变组合框的内容还是静态的?


您对各种对象的属性进行了哪些验证?是否存在任何对象的BeforeUpdate设置?


Jim


您好

如果我理解您的问题,你正试图做某种''级联''过滤.ie您在ListBox中所做的选择将用作ComboBox中查询的过滤器。


在这种情况下,我将编写ListBox中的选择(在After_Update事件中) )到表单上的未绑定(不可见/隐藏)TextBox,然后更改ComboBox中的查询,以便它使用TextBox作为匹配字段/列中的条件。


List_Box After_Update事件必须重新查询ComboBox以使新标准生效。


如果我误解了,那就忘了我的随笔。如果我在正确的轨道但你不明白,那么发布你的两个查询的细节,我会建议一些代码。

S7


< blockquote> jimatqsi - 感谢您的回复。组合框基于查询,所以内容可以更改。该表非常小,目前只有4行。任何字段都没有验证,任何对象的BeforeUpdate设置都没有。唯一定义的事件是列出的事件 - 表单加载,按钮单击和后续更新。


I am trying to set the value of a combo box based on the selection of a list box. I have created a very simple generic form to try to achieve this goal, but without success. The form has a list box bound to a query, a button, and a combo box bound to another query. The queries for the list box and the combo box are independent. I can set the value of the combo box when the form loads (sub Form_Load) and when I click on the button (sub Command2_Click), but when I make a selection in the list box (sub List5_AfterUpdate) I get Runtime error 2115: The Macro of function set to the BeforeUpdate or ValidationRule property for this field is preventing MS Access from saving the date in the field. I do not have any validation rules set and this is a complete listing of my code.

Expand|Select|Wrap|Line Numbers

解决方案

How many list members/rows are in the combo box? Does it change or are the contents of the combo box static?

What validation do you have in the properties of the various objects? Is there anything the BeforeUpdate setting of any of the objects?

Jim


Hi
If I understand your problem, you are trying to do some kind of ''cascade'' filtering.i.e. the selection you make in your ListBox is to be used as a filter for the query in the ComboBox.

In this case I would write the selection made in the ListBox (in an After_Update event) to an unbound (invisible/hidden) TextBox on your form and then change the query in your ComboBox so that it uses the TextBox as a criteria in the matching field/column.

The List_Box After_Update event would have to Requery the ComboBox for the new criteria to become effective.

If I have misunderstood, then forget my ramblings. If I am on the right track but you don''t understand, then post the details of your two queries and I''ll suggest some code.
S7


jimatqsi - thanks for the response. The combo box is based on a query, so yes the contents can change. The table is very small with only 4 rows currently. There is no validation on any field and nothing in the BeforeUpdate setting of any object. The only events defined are those listed - form load, button click and afterupdate.


这篇关于无法使用列表框选择更新组合框 - 错误2115的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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