访问RecordSet字段()需要初始化吗?

发布于 2025-01-24 21:38:38 字数 278 浏览 6 评论 0原文

我使用OnClick事件从组合框中获取值。如这里: me.com.boselproject.recordset.fields(0).value 在第一个OnClick事件中,无论选择了哪一行,该值都是从记录集的第一行。在随后的OnClick事件中,值是针对选定的行。 Combobox面对的值始终是正确的选择值。 iow comboselproject.text始终是正确的。 我尝试使用: me.com.boselclient.value = me.com.boselclient.itemdata(0),但这没有帮助。 感谢您的帮助...

I use the onClick event to get values from a combo box. As here:
Me.ComboSelProject.Recordset.Fields(0).Value
On the first onClick event, no matter what row has been selected, the value is from the first row of the recordset. On subsequent onClick events the value is for the selected row.
The value shown in the face of the combobox is always the correct selected value. IOW comboSelProject.text is always correct.
I've tried to initialize the combobox in the Form_load() procedure using:
Me.ComboSelClient.Value = Me.ComboSelClient.ItemData(0) but this has not helped.
Thanks for any help ...

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

方觉久 2025-01-31 21:38:38

点击事件发生在更改事件之前。如果要使用新值,请使用更改事件。

而且您可能应该尝试初始化组合框的.TEXT,而不是.value

The click event happens before the change event. If you want to use the new value, use the Change event.

And you should probably try to initialize the .text of the combo box rather than the .value

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文