Full Version: 1 report 2 Questions
UtterAccess Discussion Forums > Microsoft® Access > Access Reports
anghou
First I want to thank all those here who have helped me along the way. I'm happy to say that my database is coming along fantastically thanks to you guys!

I'm not very good with reports so these may be very simple things to do, but I'm drawing a blank and a quick search with the keywords I chose didn't give me any answers.

First question, I have a quarterly report that currently shows the names of clients along with the summaries of their transactions. I need to see the client's names in order to see if there are any duplicated clients with names spelled differently etc. But then I need to print out the exact same report but with the clients' names hidden. Is there an easy way to code this into the command button on the form, so that I can have one command button print a preview with the names showing and another command button that prints the report with the names hidden?

Also, on this report, I used the wizard and no matter what way I set it up, I can't get the page to break between client summaries. It either doesn't break or it puts one client per page on the report. That's silly because some clients only have one transaction whereas others may have 3 or 4 transactions. It turns my 3 page report into a 20 page report. I'm totally lost with how to make it page break before the first summary that doesn't fit at the end of the page.

Thanks so much in advance!
Angela
GroverParkGeorge
With regard to the first question, I would pass an argument through OpenArgs to the report in the code that opens it. Make it Boolean, booShowNames, for example.

In the Format event of the report section where the client names control appears, place something like the following:

Me.txtClientName.Visible = booShowNames.



With regard to the second question, I don't think I quite get your problem. You either WANT it to break between client summaries or you don't. If a client has one transaction or 20, the break is still either going to be set the way you specify.

Therefore, I suspect I may be missing some subtlety in your question.

More explanation might help.

Thanks.

George
trapperalexander
Create a group in your report using the Sort & Group tool in the report toolbar. the field you want to choose is your Client Name field. Set the Group Header Property to True and choose to sort ascending. Also you should see a property called Keep together, set this to Yes. Move the control that is bound to your client name field into this group header section. Now select the Client Name header section and open the properties window. you should see an event 'On Format' this is where you will put some code like this:
CODE
If me.openArgs = 1 then
me.ClientNameControl.Visible = False
else
me.clientNameControl.visible = True
end if


Now go to your form and open the properties window for your button that opens this report where you do not want to show the Client Name. on the Event tab of the properties window you should see [Event Procedure] in the onClick event. Click the ellipses(...) and the VBA window should open. You should see some code that opens your report something like:
CODE
Private Sub Command96_Click()
On Error GoTo Err_Command96_Click

    Dim stReportName As String
    Dim stLinkCriteria As String

    stReportName = "YourReportName"
    
    stLinkCriteria = "[PKField]=" & Me![PKField]
    DoCmd.OpenReport stReportName, acPreview, , stLinkCriteria, , [color="red"]1 [/color]

Exit_Command96_Click:
    Exit Sub

Err_Command96_Click:
    MsgBox Err.Description
    Resume Exit_Command96_Click
End Sub


notice the red text in the docmd.openReport line. Add this to your code.

HTH
niesz
>>Make it Boolean, booShowNames, for example.<<

Unless I'm mistaken and ACC2003 has changed some things, OpenArgs is always a string.
fkegley
You might also look into the Repeat Section property of the group headers. It will repeat the headings on the next page for those groups that do not all fit on the same page. This a compromise.
GroverParkGeorge
Ah, yes. I did overlook that. Thanks for the correction.
anghou
Just got back from a long weekend. Thanks so much for all the help. Now I will try to digest this stuff. sad.gif
anghou
Thanks Trapper,

I decided to try your answers and they both worked perfectly!

All you guys are Awesome! Hope you all have a wonderful day!

Angela
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.