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

How to make some controls on a report invisible when printed 1

Status
Not open for further replies.

UongSaki

Technical User
Nov 15, 2003
65
US
Is there a way to make one of the report groupings invisible if the value used in one of the group’s doe not meets a certain condition?

Here’s my grouping

CEGroup Descending
CEAttribute Ascending
CEType Ascending

Currently there are four values in the CEAttribute when the report in printed, Revenues, Expenses, Contingency, and Other. How can I make only the “Other” show on the report?

Thanks,

UongSaki
 
Hi UongSaki,

In Design view, of your report, double click on the "Detail" section, of the group, you want to format.
This will bring up the Properties dialog box, for that particular, detail section.
One of the events, in any Report section (Header, Detail,Footer) is "OnFormat"

eg;

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
If Me.txtProfit > 1000 Then
Me.txtProfit.BackColor = vbRed
Else
Me.txtProfit.BackColor = vbGreen
End If
End Sub

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
If Left(txtCountry, 1) = "A" Then Me.Detail.BackColor = vbRed Else Me.Detail.BackColor = vbGreen
End Sub

There is also "OnPrint"

Private Sub GroupHeader0_Print(Cancel As Integer, PrintCount As Integer)
If Me.txtAmount = 0 Then Me.txtAmount.Visible = True
End Sub



not sure when you want to make the controls visible, but either event, sounds like what you are looking for.

Hope this helps, good luck!
 
Hi Zion7,

Thank you very much for the tip!

UongSaki
 
Hi Zion7,

Your tips work perfectly but how do I make the blank line disappear after the control is no longer visible? I tried to set the Height property to 0 but I got an error message 2191, you can’t set height property after printing has started.

Thank you,

UongSaki
 
I'm sorry UongSaki, what blank line do you mean?
Is it the line separating the detail section, or a line, where the control should be?
I've never specifically, tried that procedure myself, or at least to print it.

 
Hi Zion7, I should have said empty space between lines where the control value occupies if it were visible.

Thanks,

UongSaki
 
So basically, this is the space for the record.
This Uong, will require a much different approach, you may have to change the recordsource, or filter property, to accomplish this...
 
I seems that my only option at this point is to changing the recordsource but that will require a redesign these reports.

Thank you for your help!

UongSaki
 
...well it may not be so difficult.
The same argument you used to format the report, can be your filter statement.



If txtCountry Like "A*" Then ....

Me.Filter = txtCountry Like "A*"
Me.FilterOn = True

Just a thought, I don't really know your application?

Good Luck either way!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top