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

hide report lines with subtotal = 0

Status
Not open for further replies.

h2mhd

Programmer
Feb 20, 2008
40
CA
Hi

i have a report with thoses fields:

- date
- item
- description
- qty
- price
- sub total

what i want to do is when we enter a descrition with no quantity or quantity =0, i just want to hide the field qty, price, sub total.

i try it but when i hide those fields the entire fields are hidden so i didnt see the lines with a quantity > 0 and sub total on my printed invoice

is there someone who can help me find a way to do that?

thanks a lot

 
How did you "try it"? Did you try conditional formatting or code or macro?

I would probably use code in the On Format event of the section of the report containing the controls.

Duane
Hook'D on Access
MS Access MVP
 
hi dhookom

thanks for your response

heres what i tried:

Private Sub Détail_Print(Cancel As Integer, PrintCount As Integer)
On Error Resume Next
PageSum = PageSum + Me.subtotal
if me.subtotal = 0 then
me.qte.visible=false
me.price.visible=false
me.souttotal.visible=false
End Sub

the problem is when i hide a field it hides all the lines even if the subtotal is greater than 0

i really dont know how to do that??

do you have a trick for me?

Thanks a lot
 
You don't have any code that sets the controls back to visible. You are also missing "End If".

Try code like:
Code:
[indent]Me.qte.visible = Me.Subtotal <> 0
Me.price.visible = Me.Subtotal <> 0
Me.souttotal.visible = Me.Subtotal <> 0[/indent]

Duane
Hook'D on Access
MS Access MVP
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top