我的复选框无法在报告中消失

时间:2019-08-11 03:07:40

标签: access-vba

我意识到我无法在报表中的复选框上使用条件格式。相反,我在复选框的顶部添加了文本框,并计划在一个字段=“ Basic Actions”时使它们可见。基本上,这使该行看起来像标题。我使用条件格式将字体设置为粗体,并使用VBA使文本框显示和消失。不幸的是,我的代码似乎无法解决问题。

 Private Sub Form_Load()
 Dim ba As String
 ba = "Basic Actions"

 If Form_Sub_MonSAChallenges.StandardAction.Value = ba Then
     Me.txt1.Visible = True
     Me.txt2.Visible = True
     Me.txt3.Visible = True
     Me.txt4.Visible = True

     Else
     Me.txt1.Visible = False
     Me.txt2.Visible = False
     Me.txt3.Visible = False
     Me.txt4.Visible = False
 End If

 End Sub

请帮助!!!

1 个答案:

答案 0 :(得分:0)

假设StandardAction是活动表单上的控件,则满足以下条件:

Private Sub Form_Load()
    Dim flg As Boolean
    flg = Me.StandardAction.Value = "Basic Actions"
    Me.txt1.Visible = flg
    Me.txt2.Visible = flg
    Me.txt3.Visible = flg
    Me.txt4.Visible = flg
 End Sub