运行时错误438隐藏页面

时间:2018-03-06 16:41:34

标签: vba ms-access access-vba

我收到了

  

运行时错误438

更改Access VBA中页面的可见性时。下面的代码称为列表框的“AfterUpdate”。经过多次审核后,我相信我的语法是正确的。我已成功测试了MsgBox的条件语句。

有什么想法吗?

Public Sub RefreshControlTabs()
If [Forms]![frmPrintPostage_Email_DB]![subfrm_CampaignData]![Channel].Value = "Mail" Then
    [Forms]![frmPrintPostage_Email_DB]![subfrm_CampaignData].[tabChannelControl].Pages(0).Visible = True
    [Forms]![frmPrintPostage_Email_DB]![subfrm_CampaignData].[tabChannelControl].Pages(1).Visible = False

ElseIf [Forms]![frmPrintPostage_Email_DB]![subfrm_CampaignData]![Channel].Value.Value = "Email" Then
    [Forms]![frmPrintPostage_Email_DB]![subfrm_CampaignData].[tabChannelControl].Pages(1).Visible = True
    [Forms]![frmPrintPostage_Email_DB]![subfrm_CampaignData].[tabChannelControl].Pages(0).Visible = False

Else
    'do nothing
    MsgBox "Valid Email/Mail channel not found for this job."
    [Forms]![frmPrintPostage_Email_DB]![subfrm_CampaignData].[tabChannelControl].Pages(0).Visible = True
    [Forms]![frmPrintPostage_Email_DB]![subfrm_CampaignData].[tabChannelControl].Pages(1).Visible = False
End If
End Sub

1 个答案:

答案 0 :(得分:3)

也许是你的行:

ElseIf [Forms]! ... [Channel].Value.Value = "Email" Then

应该是:

ElseIf [Forms]! ... [Channel].Value = "Email" Then