我有一个包含文本框和按钮的表单中嵌入的报告。
我的愿望是更新报表上的过滤器,然后重新查询和刷新表单中的报表。我对在访问中使用VBA不太熟悉,因此我很可能完全不了解如何尝试执行此操作。
单击generateExhib按钮时触发的事件如下。
嵌入为子窗体/子报表的报表名为TagReport。
Private Sub GenerateExhib_Click()
If (generatePrintedExhib.Value = False) Then
Me.TagReport.Application.DoCmd.SetFilter WhereCondition:="[Exhibitor ID] =" + ExhibitorNumber.Value + " AND [UDEntry-CheckBox1] = false"
Else
Me.TagReport.Application.DoCmd.SetFilter WhereCondition:="[Exhibitor ID] =" + ExhibitorNumber.Value
End If
Me.TagReport.Report.Application.DoCmd.Requery
Me.TagReport.Report.Application.DoCmd.RefreshRecord
End Sub
我创建了一个带有嵌入式报表的小测试表单,一个包含要过滤值的组合框和一个刷新按钮。在按钮的click事件中,我添加了以下代码:
Private Sub cmdRefresh_Click()
Dim filter As String
filter = "CardCode = '" & Me.cmbFilter.Value & "'"
'"subform_rpt" is the specific name of the embedded report.
DoCmd.ApplyFilter "Filter", filter, "subform_rpt"
End Sub
对我来说很好。我希望这将有所帮助。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句