Hi,
I have a report that is being used for a paper invoice format. There are boxes drawn on it for the user to place a check in if they wish to order the item. I didn't use the checkbox control because I didn't like the size or the the look. When the report loads, there are times when a control that contains the sale price won't have any data. This is correct. When this happens, the box should be not visible. I tried coding this but nothing is working. This is what I tried on the no data event and on the on open evert but neither worked.
If IsNull(Me.SumOfWood) Then
Me.box2.Visible = False
ElseIf Not IsNull(Me.SumOfWood) Then
Me.box2.Visible = True
End If
What am I missing or is this even possible?
Thanks!
Leesha
Visibility of Report controls based on null or not null
-
- BronzeLounger
- Posts: 1488
- Joined: 05 Feb 2010, 22:25
-
- Administrator
- Posts: 78488
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Visibility of Report controls based on null or not null
If SumOfWood is in the Detail section of the report, you should place the code in the On Format event of the Detail section:
Code: Select all
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
Me.Box2.Visible = Not IsNull(Me.SumOfWood)
End Sub
Best wishes,
Hans
Hans
-
- BronzeLounger
- Posts: 1488
- Joined: 05 Feb 2010, 22:25
Re: Visibility of Report controls based on null or not null
Thanks Hans, that worked perfectly! I didn't realize that there were events on the sections of the report.
Thanks,
Leesha
Thanks,
Leesha
-
- 5StarLounger
- Posts: 736
- Joined: 18 Mar 2010, 11:05
Re: Visibility of Report controls based on null or not null
How can this be used when based on the value of a control?
-
- Administrator
- Posts: 78488
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Visibility of Report controls based on null or not null
Could you give an example of what you have in mind?
Best wishes,
Hans
Hans
-
- 5StarLounger
- Posts: 736
- Joined: 18 Mar 2010, 11:05
Re: Visibility of Report controls based on null or not null
Silly I know, but I'm just not getting the syntax
Following on from my other thread, I would like 2 (report) controls/fields to remain hidden if a third ([InciLevel]) has a value of "RIDDOR".
Following on from my other thread, I would like 2 (report) controls/fields to remain hidden if a third ([InciLevel]) has a value of "RIDDOR".
-
- Administrator
- Posts: 78488
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Visibility of Report controls based on null or not null
Your previous thread was about a form. On a report, you have to use the On Format event of the section that contains the controls; I assume the Detail section
Code: Select all
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
Me.RIDDORdate.Visible = Not (Me.InciLevel = "RIDDOR")
Me.RIDDORno.Visible = Not (Me.InciLevel = "RIDDOR")
End Sub
Best wishes,
Hans
Hans
-
- 5StarLounger
- Posts: 736
- Joined: 18 Mar 2010, 11:05
Re: Visibility of Report controls based on null or not null
Thank you Hans. Once again you've helped me out.