So I have been working on this Access Report that essentially lays out a schedule of events for various activities at my company. We currently generate these things using Excel spreadsheets and Adobe InDesign, via add-on plugins (InData, InFlow). The problem is, we're pushing the limits of InData pretty hard, and so I've decided to try and re-engineer the things in Access. We'll still output the data in Excel, then pull it into the Database, and generate a report off of a template to match the data and all, buuuuutt, back story aside, here's the problem:
How do I draw a vertical line as a break between columns?
And no, the "draw it in pieces in each groupheader/detail/groupfo
oter section" method is utterly failing. Here's why:
The Data in the file basically defines a series of events, one per record. These events have a title, displayed in a large bold font, and optionally, a note or location. In the sample report attached here as a picture (heavily photo edited to identify the areas and remove irrelevant info), the black boxes under the date headers would be the Event title, the pink boxes the optional note, and the red boxes the optional location. Either the note, location, both, or neither may be present.
Obviously, this makes properly determining the height of the Detail section rather difficult, since the size of the boxes can change depending on their text data, so drawing the vertical line in piece meal is not easy. Instead, the bulk of the line is drawn via the Me.Line method in Detail_Print(), BUT in the left-hand column, if we run out of data to output, the line stops being drawn early! Behavior not desired.
We want the vertical line to run from a little after the top black line to a little before the bottom black line. What happens in the right hand column doesn't matter, as that's off the edge of the report and so it isn't visible.
Now the current method I've been working on, which is sometimes working and sometimes not, is to print out all of my detail items for that group. Then, I try to do some math by summing up the heights of the various outputted text boxes and labels to guess the height of that detail section (in twips) as it was drawn. I repeat until the end of detail, and then, in theory, I have my total height of the detail section in twips.
I then take that number, and subtract it from a larger number that I made up using arbitrary measurements of the page (It's supposed to be the total available area in the report that detail data can be printed in; i.e., maximum size of the columns). The resulting value I set to the Height property of the group footer. The group footer extends, theoretically, the end of the available area, drawing the remainder of the column break line with it. In the photo, that's what the grey "Gap Filler" box is. On some of the other generated pages, we get odd output, like the height calculations are off, causing the group footer to end almost 1-2 inches above the Page footer, and on others, it's almost perfect. This baffles me greatly.
So, I'm wondering if there are any saner ways, either in VBA or through the Win32 API, to draw a line on that report, vertically, in the center, dividing the columns? And have that line show up in print output? Google's been rather unhelpful as of late, though I have found a couple of rather interesting code snippets.
Oh, and the little numbers all over the picture is my debugging data....like the heights (in twips) of each box as it's drawn (the red, pink, and black numbers only).
Anyone got any thoughts on how to approach this? I'll take actual code, pointers to URLs explaining things, or suggestions on how to better do this. Ya'd think Access would have internal logic to handle the drawing of a column break line, but it seems it's either an inherently difficult thing to do, or just a feature that was left out (funny enough, I didn't see it in a trial copy of Crystal Reports either).
Start Free Trial