gpt4 book ai didi

ms-access - 检查 MS Access 表单中哪个选项卡被单击/处于事件状态

转载 作者:行者123 更新时间:2023-12-04 18:44:22 24 4
gpt4 key购买 nike

我在 MS Access 2011 中创建了一个表单,其中顶部有一个名为 TabCtl18 的选项卡控件,其中 3 个选项卡是 page1、page2、page3。
page1标签下还有3个其他标签page11、page22、page33,三个标签下分别有3个报表

现在我希望当用户单击 pdf 图标时,它会检查单击了哪个选项卡并打印该报告。

我的代码:

Private Sub cmdPrintReportPDF_Click()

If TabCtl18.TabIndex = 0 Then

If tab_graph.TabIndex = 0 Then

DoCmd.OpenReport "Graph_report", acViewNormal
DoCmd.OutputTo acOutputReport, "Graph_report"
DoCmd.Close acReport, "Graph_report"

End If
Else
If tab_graph.TabIndex = 2 Then

DoCmd.OpenReport "Graph_Report_FieldShifts", acViewNormal
DoCmd.OutputTo acOutputReport, "Graph_Report_FieldShifts"
DoCmd.Close acReport, "Graph_Report_FieldShifts"
End If

End If
End Sub

最佳答案

基于@David 强调的问题,这里是检查 TabPage 名称的方法被选中。

if tabControl1.Pages(tabControl1.Value).Caption = "TabPageName" then
'Do Something
end if

此外,您可以在 Tab 中使用此代码控制 Click检查哪个页面处于事件状态的事件。

关于ms-access - 检查 MS Access 表单中哪个选项卡被单击/处于事件状态,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6142927/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com