控件源中的表达式和默认值 [英] Expression in control source and default value

查看:37
本文介绍了控件源中的表达式和默认值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在这里拉头发.我想将 2 个子表单字段链接到主表单中的一个字段.我使用 Parent.MyFieldName.Column(3) 作为第一个子表单字段的控件源,并且显示正常.我的第二个子表单字段的行源使用第一个子表单字段作为其查询的条件.问题是当我使用上面的代码时,这个组合框仍然是空的,但是如果我给第一个字段一个常量值,它就会被填充.感觉就像在从第一个子表单字段检索数据之前填充组合框.我尝试将上面的代码表单控件源移动到默认值,但随后两个字段都保持为空.

I am pulling my hair here. I want to link 2 subform fields to a field in the main form. I used Parent.MyFieldName.Column(3) for the control source of the first subform field and it is displayed fine. The Row source of my second subform field is using the first subform field as a criteria for its query. The problem is that this combobox remains empty when I use the above code but is populated if I give the first field a constant value. Feels like the combobox is getting filled before the retrieval of data from the first subform field. I tried moving the above code form control source to default value but then both fields remain empty.

我做错了什么?

推荐答案

我找到了无法正常工作的主要原因 - 子窗体控件在主窗体的其余部分之前加载.这意味着当我的子表单下拉菜单在其他表单字段中查找数据时,它们仍未出现,因此我只剩下一个空的下拉菜单.

I have found the main reason why things weren't working - Subform controls load before the rest of the main form. This means that at the time my subform dropdown menu seeks the data in the other form fields they still haven't appeared and thus I am left with an empty dropdown menu.

我通过删除子窗体控件的源对象并添加来解决这个问题

I solved this by removing the sourceobject of the subform control and adding

Me!Subform1.SourceObject = "SubformOtpuskaneIzhMat"

在主窗体的某些事件中.

In some events in the main form.

这篇关于控件源中的表达式和默认值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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