我有以下报告显示:
F1 | F2 | F3 |
`````````````````````````````
TRUE | TRUE | FALSE |
TRUE | FALSE | FALSE |
FALSE | N/A | N/A |
如您所见,我想仅在F1为真时才显示字段F2和F3。 F1是假的,F2和F3应该显示" N / A"无论他们的真正价值如何。
我怎么能这样做?我试过了
Private Sub Detail_Format(Cancel As Integer, PrintCount As Integer)
If (Me.F1 = false) Then
Me.F2.Visible = False
Me.F3.Visible = False
End If
End Sub
但是这不会改变文本的值(只删除我可以解决的字段),但是它也会删除所有字段;不只是那一行中的一个。我怎么能做到这一点?
答案 0 :(得分:1)
最简单的方法是将控件从F2重命名为txtF2,然后将控件源设置为函数。
=iif(F1=true,F2,"N/A")
关于设置可见性,您必须放入双方:
Private Sub Detail_Format(Cancel As Integer, PrintCount As Integer)
If (Me.F1 = false) Then
Me.F2.Visible = False
Me.F3.Visible = False
Else
Me.F2.Visible = True
Me.F3.Visible = True
End If
End Sub
或更简单:
Private Sub Detail_Format(Cancel As Integer, PrintCount As Integer)
Me.F2.Visible = Me.F1
Me.F3.Visible = Me.F1