Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to hide zero value fields in reports

Status
Not open for further replies.

sdb0812

Programmer
May 29, 2003
14
US
How can I make a text box in a report not to be visible to the user if the value is "" or Null??

I thought this would be simple, but I haven't found a simple solution or even a solution at this point.

thanks,
Scott
 
The following example was based on a very simple table with 3 columns. The report based on the table "hides" the d3 field if the data field is visible. I placed the code in the on-format event of the detail section. I think you can even skip printing a line with these events - haven't used it to do that in a few years though.

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
If IsNull([data]) Then
d3_data.Visible = False
Else
d3_data.Visible = True
End If


End Sub

HTH - Jimmy
 
That is what I tried to do early on but for some reason I kept getting an run time error saying, "The object doesn't have access to object or method". The code I used is below:

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
Dim result As Boolean

result = IsNull(txtSearchLineItemSSNResult.value)
If (result = False) Then
txtSearchLineItemSSNResult.Visibal = True
Else
txtSearchLineItemSSNResult.Visibal = False
End If
End Sub

It keeps caughing on the 1st instance of the .Visibal method

Thanks,
Scott
 
I may be completely wrong, but I believe the problem is just in the spelling of the method - I am betting if you change Visibal to Visible that will remove your problem.
 
Duh...lol

I have never won a spelling bee and now you know why. You are correct and it works like a charm now!!

Thanks a million,
Scott
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top