重新问题 [英] Requery question

查看:52
本文介绍了重新问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,


我已经通过帖子,看到很多类似于我想解决的帖子,但还是没能得到结果。


这是设置:


我有一个名为WorkOrderF的表格


在此表单上有一个名为[GototenantCombo]的Unbound组合框。这个组合框查找查询[WOSourceQ](我的活动工单)并返回我想要处理的记录。


我使用弹出窗体[NewWorkOrder]添加其他客户到[WOSourceQ]

一旦我向新客户添加了新客户,就会出现在组合框[GoToTenantCombo]中,到目前为止一切都很好。


我遇到的问题是WorkOrderF表单中的子表单WODDescriptionSF。它是(主要和子项与工作单的ID链接。


子表单WODDescriptionSF从[WODSourceQ]获取值,这是需要重新查询的表单。


我到目前为止管理的是点击功能区上的RefreshAll命令,但我很乐意放弃这一步。


任何人都可以提供帮助?


PS:Access 2010是否附带(全部刷新)命令?我可以在大约10个模块中使用该darn命令。为什么MS仍然会忽略这么有用的东西?

解决方案

对于requery,您可以使用命令Me.requery或Me.subformname.requery来表示子表单。

此行应添加到组合框的AfterUpdate事件的代码中。


当此命令不起作用时(Access有时会很顽固)我使用:

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


正如Nico所说的那样需要 .Requery 表格(或所有相关表格)。查看参考子表单上的项目如何从另一个表单中引用一个表单,如果你从弹出表单中执行它,将需要这个表单。


PS。干得好,可以在问题中包含对象的名称。非常有用,但经常被忽视;)


我忘了提一件事 - 我已经使用了组合框的AfterUpdate和宏。


更清楚:


我的父表单是[WorkOrderF]它的记录源是查询[WOSourceQ]


此表单有一个Unbound Lookup Combobox [GoToTenantCombo]与记录源表[TenantT]。它的AfterUpdate有一个宏:


SearchForRecord


对象类型:Null

对象名称:Null

记录:首先

条件:=" [TenantID] =" &安培; Str(Nz(Screen.ActiveControl,0))

我的父表单有子表单(父和子链接:[WOID]称为[WODDescriptionSF],带有记录源查询[WODSourceQ]


我使用布尔值开关是/否来确定工作单​​是否有效以及父表和子表的源查询的标准。

当我想介绍新的租户和工作单时,我使用弹出窗体[AddNewTenantF]和记录源表[WorkOrderT]以及带有以下行源的组合框:

展开 | 选择 | < span class =codeLinkonclick =WordWrap(this);> Wrap | 线麻木ERS

Hi All,

I''ve gone through the post and saw many posts similar to what I am looking to solve but haven''t been able to get results still.


Here is the setup:

I have a form named WorkOrderF

On this form there is an Unbound combo box called [GototenantCombo]. This combo box lookup a query[WOSourceQ] (my active work orders) and returns the record that I want to work on.

I use a pop up form [NewWorkOrder] to add other customers to [WOSourceQ]

Once I''ve added a new customer to new customer shows up into the combo box [GoToTenantCombo], everything good so far.

The problem that I have is with the subform WODDescriptionSF inside WorkOrderF form. It is (master and child linked with the ID of the work orders.

The subform WODDescriptionSF get values from [WODSourceQ] and this is the form that needs to be requery.

HOw I have been managing so far is by clicking RefreshAll command on the ribbon but would love to be able to forgo that step.

Can Anyone help?

PS: Does Access 2010 comes with (refresh all) command? I could use that darn command in about 10 modules. why is something so useful still being ignored by MS?

解决方案

For the requery you could use the command "Me.requery" or "Me.subformname.requery" for just the subform.
This line should be added in the code for the AfterUpdate event of the combobox.

When this comand doen''t work (Access is stubborn sometimes) I use:

Expand|Select|Wrap|Line Numbers


As Nico says you need to .Requery the form (or all relevant forms). Check out Referring to Items on a Sub-Form for how to refer to one form from another, which will be required if you''re doing it from the pop-up form.

PS. Well done for including the names of your objects in the question. So useful, yet often overlooked ;)


One thing I forgot to mention - I already use the AfterUpdate of the combobox with a Macro.

More clearly:

My Parent form is [WorkOrderF] it''s record source is query [WOSourceQ]

This form has an Unbound Lookup Combobox [GoToTenantCombo] with record source table [TenantT]. It''s AfterUpdate has a macro:

SearchForRecord

Object type: Null
Object name: Null
Record: First
Where Condition: ="[TenantID] = " & Str(Nz(Screen.ActiveControl,0))

My parent form has child form(parent&Child Link:[WOID] called [WODDescriptionSF] with record source query [WODSourceQ]

I use a Boolean switch yes/no to determine if the work order is active or not and the criteria for both source queries of the parent and child form.

When I want to introduce a new tenant and work order I use a pop up form[AddNewTenantF] with record source table [WorkOrderT] and a combobox with the following row source:

Expand|Select|Wrap|Line Numbers


这篇关于重新问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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