无法从组合框中获得价值 [英] Can't get value from Combo Box

查看:58
本文介绍了无法从组合框中获得价值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个包含14个组合框的子窗体cbo1到cbo14,我正在尝试动态设置ControlSource,然后显示值。


我正在使用的代码是

I have a subform with 14 combo boxes on it cbo1 to cbo14, and am trying to dynamically set the ControlSource, then display the value.

The code I am using is

展开 | 选择 | Wrap | 行号

推荐答案

PhilOfWalton:


更简单的语法立即窗格:我!Subform1.Form!ControlName
我!frmInstructionSubform.form!cbo1
http://access.mvps.org/access/forms/frm0031 .htm


LONG版本
?forms.Item(" ParentFormName")。Controls(" SubFormCon trolName")。 Form.controls.item(" ControlName")。value


你拉了(" cbo" &安培; CStr(Inti))。

超出命令并首先将其设置为字符串值?

这样我们就可以确保你的字符串了正确解析 - 例如:
PhilOfWalton:

Easier Syntax for the immediate pane: Me!Subform1.Form!ControlName
Me!frmInstructionSubform.form!cbo1
http://access.mvps.org/access/forms/frm0031.htm

LONG version
?forms.Item("ParentFormName").Controls("SubFormCon trolName").Form.controls.item("ControlName").value


Have you pulled ("cbo" & CStr(Inti)).
Out of the command and set it as a string value first?
This way we can make sure your strings are resolving correctly - for example:
展开 | 选择 | Wrap | 行号


感谢您的回复。


我已经尝试过你的建议


这里修改后的代码如上所示

Thanks for coming back.

I have tried your suggestion

Here the modified code as suggested

展开 < span class =codeDivider> | 选择 | Wrap | Line数字


debug.print zStr 为您提供已解析的字符串?


显式设置Line7 .Item(zStr).value

从父级引用子窗体控件时我发生了不寻常的事情您必须明确将结果返回给父母 - 孩子!
What does debug.print zStr give you for the resolved string?

Explicitly set Line7 .Item(zStr).value
I''ve had unusual things happen when referencing subform controls from the parent where you have to be explicit in order to get the result back to the parent - children!


这篇关于无法从组合框中获得价值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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