如何从另一个表单重新查询表单上的列表框 [英] How to requery a listbox on a form from another form

查看:74
本文介绍了如何从另一个表单重新查询表单上的列表框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

伙计们,


我有一个令人烦恼的问题,我似乎无法理解。我有一个主要或主页表单,其中有一个选项卡控件,其中包含一个基于查询的列表框,并显示库存级别。


从我的发票表单中,一次我已经完成了库存更新计算(我正在研究更优雅的解决方案),我需要在主窗体上重新查询列表框,以确保显示的库存值是最新的。

我试过''一切''!从发票表单中打开并关闭主表单,从发票表单中重新查询列表框,在主表单具有焦点后重新查询列表框等。单击主表单上的重置按钮更新列表框就好了 - 我试过了cmdReset_Click来自发票表单(在Access 97中工作!),但在2007年出错。


对不起,它太平凡了,但很久就写出来了!有人可以帮忙吗?


非常感谢。


stonward

解决方案

显示我们用来刷新列表框的代码。另外,错误消息的文本是什么?


我没有收到任何错误消息,Rabbit。我尝试的最新事情是在发票表格的关闭事件中的DoCmd.Requery(... listbox55)。


我现在猜测我将会有在重新查询列表框之前完全关闭发票表单。从本质上讲,我几乎在每个活动都尝试过Requery命令!


感觉这是一个如此愚蠢,烦人的问题(不像我与Allen Brownes''onHand'的挣扎'代码!),并没有多少方法真正使用requery。


感谢您的时间 - 特别是在这个时候。


问候,


stonward


完全可以使用:

展开 < span class =codeDivider> | 选择 | Wrap | Line编号

Hi again fellows,

I''ve got an annoying issue I can''t seem to fathom. I have a Main or ''Home'' form that has a tab control which houses a listbox, which is based on a query, and shows stocklevels.

From my invoicing form, once I''ve done my stock update calculations (I''m working on a more elegant solution), I need to requery the listbox on the main form to ensure the stock values shown are up to date.

I''ve tried ''everything''! Open and close the main form from the invoice form, requery the listbox from the invoice form, requery the listbox once the main form has the focus etc. Clicking my reset button on the main form updates the listbox just fine - I''ve tried cmdReset_Click from the invoice form (worked in Access 97!), but gives an error in 2007.

Sorry its so mundane, yet long to write out! Can someone help?

Many thanks.

stonward

解决方案

Show us the code that you''re using to refresh the list box. Also, what is the text of the error message?


I don''t get any error messages, Rabbit. The latest thing I tried was DoCmd.Requery(...listbox55) in the Close event of the invoice form.

I''m guessing now that I''m going to have to fully close the invoice form before requerying the listbox. Essentially, I''ve tried the Requery command at just about every event!

It''s feels such a silly, annoying issue (unlike my struggles with Allen Brownes ''onHand'' code!), and there aren''t many ways really to use requery.

Thanks for your time - especially at this time.

Regards,

stonward


It''s perfectly possible to do by using :

Expand|Select|Wrap|Line Numbers


这篇关于如何从另一个表单重新查询表单上的列表框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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