Question : Supressing controls with Null values in Access Report

Does anyone have any idea on how to supress (set Visible to No) controls with a Null value?  I have a uni assignment that requires me to do this for one particular report and I can't work it out!

The code I have tried in the OnFormat and OnPrint  event handler is provided below, where PaymentID and Label35 are the controls I want to hide if PaymentID is null.  I was under the impression OnFormat would be the correct event handler, it didn't work so I tried the OnPrint too, to no avail.

I tried to attach the *.accdd file which did not work, so zipped it, and the zip file didn't work either, if anyone has a suggestion as to how to attach an Access 2007 db to this site, that would be appreciated too.

 Any help will be much appreciated, the clock is a tickin'!!

Cheers,

Simon
Code Snippet:
1:
2:
3:
4:
5:
6:
7:
8:
9:
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
If IsNull(Me!PaymentID) = True Then
  Me!PaymentID.Visible = False
  Me!Label35.Visible = False
Else
  Me!PaymentID.Visible = True
  Me!Label35.Visible = True
End If
End Sub
Open in New Window Select All

Answer : Supressing controls with Null values in Access Report

Sure... break points work. In fact, I initially set a break point ... and of course it stopped.

You are setting a break point on this line, right:

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)

?

I looked here ... nothing jumped out about this issue:
http://allenbrowne.com/Access2007.html#Bugs

Not sure what else I can add ...

mx
Random Solutions  
 
programming4us programming4us