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 MikeeOK on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

report - hide text box when value is 0

Status
Not open for further replies.

Achmed

Technical User
Jun 4, 2001
64
CA
Hi everybody,

I'm running a report that summarizes invoices. I have a textbox that calculates the total of each invoice. It looks something like this:

=NZ([Labour],0) + NZ([Parts],0)

My problem is when both Labour and Parts are empty, the textbox shows a 0. I don't want this, but I can't seem to get it to go away.

Is there something I can do? I thought I could hide the field if its value is 0, or make the font colour the same as the background so you can't see it... but how!

Any help is greatly appreciated.

Thanks
-Alan
 
Sure... Set color to White should do it. Or create an box object to hide and display.

Here is how I toggle a grey box on a printout (Report Form) to simulate old green bar paper. Also, based on one value, I bold the text. This is where u could make the color white. And should do the trick for u. htwh,..


...
Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
If Me.SECURITYGROUP = "PR06" Then
Me.USERID.FontWeight = 700
Me.USERNAME.FontWeight = 700
Me.SECURITYGROUP.FontWeight = 700
Me.DESCRIPTION.FontWeight = 700
Else
Me.USERID.FontWeight = 400
Me.USERNAME.FontWeight = 400
Me.SECURITYGROUP.FontWeight = 400
Me.DESCRIPTION.FontWeight = 400
End If
'Toggle Grey Box
If Me.Box20.BackStyle = 1 Then
Me.Box20.BackStyle = 0
Else
Me.Box20.BackStyle = 1
End If

End Sub

Steve Medvid
"IT Consultant & Web Master"
e-Mail: Stephen_Medvid@GMACM.com

Chester County, PA Residents
Please Show Your Support...
 
I'm still having a problem with that... it won't accept this line of code:

If Me.TextBox = "0" Then

This will work if I choose a field from the table and check the value, but not when I use the textbox.

What am I doing wrong?

-Alan
 
mmmm... not sure? In my case, I name all my fields on the report form the same as the database field names. What is TextBox set to as a data control source?

Steve Medvid
"IT Consultant & Web Master"
e-Mail: Stephen_Medvid@GMACM.com

Chester County, PA Residents
Please Show Your Support...
 
You could try putting

If IsNull(total) Then
total.Visible = False
End If

in the On Format setion which the total field is in

Hope this helps
Hymn
 
Thanks everybody... I used a variation of smedvid's code and placed the event in the section hymn said to put it whamo. All better.

Thanks for the help!
-Alan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top