Suppress printing detail lines

proulxr

Registered User.
Local time
Today, 01:40
Joined
Mar 15, 2010
Messages
14
Hello, I need to suppress printing detail lines with a certain transaction type...I have TAX transactions I do not want to print but I will still total them...any help would be appreciated
 
Hello, I need to suppress printing detail lines with a certain transaction type...I have TAX transactions I do not want to print but I will still total them...any help would be appreciated

I would suggest that you place code in the Detail Section's On Format event to hide the section (visible = false) for the records you do not want to print.
 
I would suggest that you place code in the Detail Section's On Format event to hide the section (visible = false) for the records you do not want to print.
Not a VB guy but tried this and nothing happened...

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
If Me.Tax <> 0 Then Visible = False
End Sub

Any suggesions
 
I would suggest that you place code in the Detail Section's On Format event to hide the section (visible = false) for the records you do not want to print.

Not a VB guy , tried this but nothing happened...

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
If Me.Tax <> 0 Then Visible = False
End Sub

Any suggestions...
 
Almost there :) You need to call the control's visible property and also need to make visible if it doesn't meet the condition.
Code:
If Me.Tax <> 0 Then
    Me.Visible = False
Else
    Me.Visible = True
End If
 
Almost there :) You need to call the control's visible property and also need to make visible if it doesn't meet the condition.
Code:
If Me.Tax <> 0 Then
    Me.Visible = False
Else
    Me.Visible = True
End If

Thanks for the help so far...I am learning...

Here is what I have in the ON FORMAT of the Detail Property Sheet as an Event Procedure...

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
If Me.Tax <> 0 Then
Me.Visible = False
Else
Me.Visible = True
End If
End Sub
...

But the Tax lines still show...?

here is a page of the report...any thoughts? I do appreciate the help...
 

Attachments

  • tax.JPG
    tax.JPG
    69.1 KB · Views: 168
What is the Tax value you don't want to show? Anything that is not 0?

Revised code:
Code:
If Me!Tax <> 0 Then
    Me.Visible = False
Else
    Me.Visible = True
End If
 
What is the Tax value you don't want to show? Anything that is not 0?

Revised code:
Code:
If Me!Tax <> 0 Then
    Me.Visible = False
Else
    Me.Visible = True
End If

Tryied with the Me!Tax instead of Me.Tax...same results...

I do not want the detail line to print if the tax is not = zero...therefore suppressing any line with tax on it...I will still sum the tax to be totaled after each group... does it make sense to you...
 
Last edited:
How many controls have you got on the Detail section that needs to be hidden?

You can't suppress a whole section, so you would need to hide each control:

Code:
If Me!Tax > 0 Then
         Control1.Visible = False
         Control2.Visible = False
         ... etc
Else
         Control1.Visible = True
         Control2.Visible = True
         ... etc
End If

If there are many controls then there is a quicker way.
 
How many controls have you got on the Detail section that needs to be hidden?

You can't suppress a whole section, so you would need to hide each control:

Code:
If Me!Tax > 0 Then
         Control1.Visible = False
         Control2.Visible = False
         ... etc
Else
         Control1.Visible = True
         Control2.Visible = True
         ... etc
End If

If there are many controls then there is a quicker way.

If you look at the JPG you can see the detail line has 7 fields...I would have to suppress all 7? is there an alternate way of not printing the tax lines?
 
Same code as before but for the IF statement you should be checking against TRANS TYPE.

IF Me![TransType] = "Tax" Then
... etc

Change it to the name of the Trans Type field.
 
Same code as before but for the IF statement you should be checking against TRANS TYPE.

IF Me![TransType] = "Tax" Then
... etc

Change it to the name of the Trans Type field.

OK changed Detail Property ON FORMAT TO

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
If Me!TransType = "Tax" Then
Me.TransType.Visible = False
Me.TransDate.Visible = False
Me.Quantity.Visible = False
Me.ItemID.Visible = False
Me.ItemName.Visible = False
Me.HCPC.Visible = False
Me.Total.Visible = False
Else
Me.TransType.Visible = True
Me.TransDate.Visible = True
Me.Quantity.Visible = True
Me.ItemID.Visible = True
Me.ItemName.Visible = True
Me.HCPC.Visible = True
Me.Total.Visible = True
End If
End Sub



....Tax lines still print...attached JPG Shows where I put the event procedure...

Thanks for this help... I appreciate it and am learning alot...
 

Attachments

  • Detail event.jpg
    Detail event.jpg
    92.4 KB · Views: 152
Glad to know you're learning :)

Remember that the control (i.e. the text box) may be called TransType but is the field actually called TransType? Check that to confirm. Once you've done that ensure that you amend the code. Also use this instead:

If Trim(Ucase(Me!TransType)) = "tax" Then
 
Glad to know you're learning :)

Remember that the control (i.e. the text box) may be called TransType but is the field actually called TransType? Check that to confirm. Once you've done that ensure that you amend the code. Also use this instead:

If Trim(Ucase(Me!TransType)) = "tax" Then

The control on the field is TransType...made the change...


Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
If Trim(UCase(Me!TransType)) = "Tax" Then
Me.FullName.Visible = False
Me.TransType.Visible = False
Me.TransDate.Visible = False
Me.Quantity.Visible = False
Me.ItemID.Visible = False
Me.ItemName.Visible = False
Me.HCPC.Visible = False
Me.Total.Visible = False
Else
Me.FullName.Visible = True
Me.TransType.Visible = True
Me.TransDate.Visible = True
Me.Quantity.Visible = True
Me.ItemID.Visible = True
Me.ItemName.Visible = True
Me.HCPC.Visible = True
Me.Total.Visible = True
End If
End Sub

Still seeing tax lines...do I have this event in the right spot (Detail), do i have to do anything except Save it?
 
Attached is the database...once you get it running...page 6 is a good place to check for Tax lines...

Thanks for look at this for me....
 

Attachments

Find attached. See if you can spot what was amended :)


I see the TRIM was changed...what does the LCASE function do?

I still see Tax lines on Page 6 though? Do you have them in yours on page 6?
 
Last edited:
It's not visible on mine. What version of Access are you using?
 
It's not visible on mine. What version of Access are you using?

I am running 2007...:(

Do I have to do anything to invoke the event procedure other that put it on the ON FORMAT Line?
 

Users who are viewing this thread

Back
Top Bottom