Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
grrr223
Starting Member
30 Posts |
Posted - 2004-03-09 : 13:00:34
|
After several frustrating days, I have become the Border-Master, being able to add, show, move, etc. any line or object on my report at will using VBA. That being said, I know how to get a line to turn on or off, but I still need the proper condition to do the following:I am creating a monthly customer statement displaying rows grouped by type: invoice, payment, credit, etc. I have created a border that forms a box around each group. The vertical lines are in the detail section, and the horizontal (top and bottom) lines are in the group header and footer. It works great, except when a group exceeds one page, then there is no bottom line on the first page and then no top line on the second page because there are no group headers and footers in the middle of the group. I know you can tell the Group Header to repeat at the top of every page, but you can't do that for the Group Footer. So what I think I want to do is to add the top and bottom borders to the detail section and tell them only to show when they are the first or last items on the page, but I haven't been able to figure out what condition I can use to do this. Any help would be greatly appreciated |
|
jsmith8858
Dr. Cross Join
7423 Posts |
Posted - 2004-03-09 : 17:06:43
|
here's something that might work:I have noticed that when the detail section is formatted, if you trap that event you can reference "me.top" and it changes each time, depending on where the current section is printing on the page. for example, create a report, base it on a table with at least 100 rows, and add a label called "label1" in the detail section. make the detail section about .25" tall.Add this event to the report:Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer) Label1.Caption = Me.TopEnd Sub Notice that when you run the report, you can see the value change as it moves down the page... so, you SHOULD be able to put an invisible line at the bottom of your detail section, and on the format event, check the "me.top" value. if it is greater than a certain value (you will have to test to find out this value), then it will be the last detail line printed on that page, and therefore you should make the horizontal line visible. this will, in effect, allow you to "close off" your box at the bottom of the page.does this make sense? it should work, i just don't have time to test it for you. but something like:Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer) if me.top > 14400 then ' some value for you to determine line1.visible = true else line1.visible = false end ifEnd Sub and use the technique to put the value of "me.top" in a label as the report prints to help you determine this value.let me know if it works, or if you need more assistance. but a true "BorderMaster" should be able to make it happen !!good luck- Jeff |
 |
|
grrr223
Starting Member
30 Posts |
Posted - 2004-03-09 : 22:32:01
|
Thank you very much for your help. At 6 PM I was handed a list of "ONLY 28 ITEMS" to fix on my statements before tomorrow, and it's 10:30 now, and this is one of the 3 I have left, so I can't tell you how happy this makes me.I will try what you have suggested when I get home. If it doesn't work, I think I am going to try something similar to this:http://www.tek-tips.com/gfaqs.cfm/lev2/4/lev3/27/pid/703/fid/2307It uses an array to display "Page X of Y" for a group. I figure it would be very analogous to just change a few variable names and place it in the appropriate section to get a "Detail section X of Y" to count the records in a group on a page, and then have it display the border when X = Y. I don't like arrays after a nasty run-in with one over the weekend, but maybe it'll give me something to do that opens up tons of other possibilities.I'll let you know how it turns out.One last quick question, is there any way to specify my me.top measurements in inches. Twips are a pain in the @$$, it would at least save me the time converting the damned things. Thanks again! |
 |
|
jsmith8858
Dr. Cross Join
7423 Posts |
Posted - 2004-03-10 : 07:50:10
|
quote: Twips are a pain in the @$$, it would least save me the time converting the damned things.
??just multiply or divide by the conversion rate .... i think it's 1440 ... if that's too hard, you have much bigger problems than I can help with ! - Jeff |
 |
|
|
|
|
|
|