Report Data Suppresssion (1 Viewer)

Tupacmoche

Registered User.
Local time
Today, 11:03
Joined
Apr 28, 2008
Messages
291
Hi Report Experts,

I have a payment section(not a band) in the detail section that shows pay by Check, Cash, Wire, ect. Since, payment can be made by any of these methods and others, I have placed all the payment methods under a text box that reads "Payment Information". I have set the visibility property to false in vba code, for example: CheckNum.Visible = False. Now, I have a case statement that changes visibility to True if that payment method is stored on the current row. Here is the code:

Select Case GiftHowPay
Case "Check"
Me.GiftCheckNo.Visible = True
Me.GiftRecptDt.Visible = True
Me.GiftCkAmt.Visible = True

Case "Cash"
Me.GiftCashAmt.Visible = True

Case "Credit Card"
Me.GiftCreditCardNum.Visible = True
Me.GiftNameonCard.Visible = True
Me.GiftCardExpDt.Visible = True

Case "Wire (EFT)"
Me.GiftWireAmt.Visible = True

Case "Securities"
Me.SecStockName.Visible = True
Me.SecTicker.Visible = True
Me.SecNumofShares.Visible = True
Me.SecHigh.Visible = True
Me.SecLow.Visible = True
Me.SecAve.Visible = True
Me.SecValue.Visible = True

Case "Pre-deposited"
Me.GiftPredeposited.Visible = True

End Select

Now, to the problem. When, I open the report Check visibility is set to True since GiftHowPay = Check in the first record. But as I move from row to row the other payment types don't become visiable like Cash, Wire, ect. All this code is in the report_Load() event procedure. What do, I do to make this work?:banghead:
 

MarkK

bit cruncher
Local time
Today, 08:03
Joined
Mar 17, 2004
Messages
8,178
Because a report formats and prints sections repeatedly, and because some report sections, once they've been printed, cannot be un-printed and changed (the page might have already left the printer, for instance), therefore you need to set visibility of controls in the Format event of the report section in which they appear.

So move that code out of the Form_Load() event handler, which can obviously only ever fire once in the lifetime of the report, and move it into the Format event handler for the section in which those controls appear.

Makes sense?
Mark
 

Tupacmoche

Registered User.
Local time
Today, 11:03
Joined
Apr 28, 2008
Messages
291
Hi Mark,

This makes perfect sense. I also, put the same code into the on Current section and it did nothing. I did what you said and it worked fine with the exception that it is not changing for all the payment methods. I checking for spelling errors. But, there is another curious issue it now keeps throwing a critical error and closing Access. Any thoughts on why that would happen?:confused:
 

MarkK

bit cruncher
Local time
Today, 08:03
Joined
Mar 17, 2004
Messages
8,178
Does the error have a description, or is Access just crashing without warning?
Mark
 

Tupacmoche

Registered User.
Local time
Today, 11:03
Joined
Apr 28, 2008
Messages
291
Hi Mark,

I discovered what went wrong. I simple copied the code from the on load section which included Refresh code. So, as you know the detail band was redrawing it self over and over. Thanks for your assistance!:)
 

Tupacmoche

Registered User.
Local time
Today, 11:03
Joined
Apr 28, 2008
Messages
291
Hi Mark,

Just one follow-up on this matter. Can a similar filter be put on a form? In the case of the form a case statement will filter a set of reports based on the value in a column. So, for example if a row has a giftType = 'pledge' the pledge report would be used. See below:

Select Case GiftType
Case "Pledge"
DoCmd.OpenReport "rptPledge", acViewReport, , Me.Filter Case "Pledge Payment"
DoCmd.OpenReport "rptPledge Payment", acViewReport, , Me.Filter
End Select

Will this work?
 

MarkK

bit cruncher
Local time
Today, 08:03
Joined
Mar 17, 2004
Messages
8,178
To find out if it will work, it's almost certainly quickest to try it and see what you run into. I don't see an obvious problem with it.
hth
Mark
 

Users who are viewing this thread

Top Bottom