需要持有一个子表格 [英] need held with a subform

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

问题描述

我有一个未绑定的表格(A)。表单包含从不同表中获取信息的列表框。打开表单时,列表中会填充各种数据。操作员将从列表框中选择某些项目。


我有一个查询(Z),它使用操作员在表格(A)上选择的信息。此信息列在查询的条件部分。


我有一个绑定查询(Z)的表单(B)。


在表格(A)上我有一个打开表格(B)的命令按钮。这很好用。

显示查询Z中的所有数据。


我在表单(A)上创建了一个子表单(C),它应该显示表单(B)中出现的结果。我不知道如何更改命令按钮代码以实现此目的。有没有人有任何想法?我已经列出了我目前正在使用的命令代码。


私有子Command34_Click()

错误GoTo Err_Command34_Click


Dim stDocName As String

Dim stLinkCriteria As String


stDocName =" B"

DoCmd。 OpenForm stDocName ,,, stLinkCriteria


Exit_Command34_Click:

退出子


Err_Command34_Click:

MsgBox Err.DESCRIPTION

恢复Exit_Command34_Click


结束Sub

I have an unbound form (A). The form contains lists boxes that get information from different tables. When the form is opened the lists are populated with various bits of data. The operator will select certain items from the list boxes.

I have a query (Z) that uses the information the operator selects on form (A). This information is listed in the criteria section of the query.

I have a form (B) that is bound to query (Z).

On form (A) I have a command button that will open form (B). This works great.
All data from query Z is displayed.

I created a subform (C) on form (A) that should display the results that appear in form (B). I am not sure how to change the command button code to make this happen. Does anyone have any idea''s? I have listed the command code I am currently using.


Private Sub Command34_Click()
On Error GoTo Err_Command34_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "B"
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_Command34_Click:
Exit Sub

Err_Command34_Click:
MsgBox Err.DESCRIPTION
Resume Exit_Command34_Click

End Sub

推荐答案

你''我希望按钮重新查询子表单。
You''ll want the button to requery the subform.



您将需要按钮来重新查询子表单。
You''ll want the button to requery the subform.



ok。我会将现有代码保留在onclick命令中还是需要更改?如果是这样,怎么做?

ok. would I keep the existing code in the onclick command or would that need to change? if so, how?


你需要改变它,因为我假设你想要使用子表单而不是使用第二种形式。很明显你会想要摆脱这一行。


通常使用控件的Requery方法完成重新查询。
You''ll need to change it because I''m assuming you want to go with a subform instead of using a second form. So obviously you''ll want to get rid of that line.

A requery is usually done using the Requery method of the control.


这篇关于需要持有一个子表格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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