Grow Vertical Line

  • Thread starter Thread starter Proposal Doctor
  • Start date Start date
P

Proposal Doctor

I have a report that is based on a government form that has several vertical
lines. One of the lines in the report needs to be pegged to a horizontal
line and to grow downward if information in one of the fields on either side
of the line increases by more than four lines. The bottom of the line needs
to stop at the intersection of another horizontal line. (I have been solving
this by opening the report in design view and extending the line manually.
That's getting old and other users won't know what to do.)

I have tried the Me.Line technique on the MS website and either I am missing
something or it doesn't work in Access 2007. Has anyone gotten Me.Line to
work with Access 2007? Is it possible to peg the bottom of a growing line to
a horizontal line?

The line is in the Detail section. The report includes a subreport. And
the report is based on a parameter query with a two table join.

Only one of the vertical lines needs to grow. None of the vertical lines in
the subreport need to grow but that would be nice in the future. And the
ultimate goal is to output to PDF, which I have working super.

Thanks.

David
 
I have a report that is based on a government form that has several vertical
lines. One of the lines in the report needs to be pegged to a horizontal
line and to grow downward if information in one of the fields on either side
of the line increases by more than four lines. The bottom of the line needs
to stop at the intersection of another horizontal line. (I have been solving
this by opening the report in design view and extending the line manually.
That's getting old and other users won't know what to do.)

I have tried the Me.Line technique on the MS website and either I am missing
something or it doesn't work in Access 2007. Has anyone gotten Me.Line to
work with Access 2007? Is it possible to peg the bottom of a growing line to
a horizontal line?

The line is in the Detail section. The report includes a subreport. And
the report is based on a parameter query with a two table join.

Only one of the vertical lines needs to grow. None of the vertical lines in
the subreport need to grow but that would be nice in the future. And the
ultimate goal is to output to PDF, which I have working super.


The Line method should work if the two horizontal lines are
in the same section and the code is in the section's Print
event procedure:

Me.Line (Xposition,Me.line1.Top) - (Xposition, Me.line2.Top)

You never said what the horizontal position of the vertical
line should be so you'll have to replace my generic place
holder.
 
If I understand you correctly, I should have something like:


Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)

Me.ScaleMode = 1
Me.ForeColor = 0
Me.Line (5.5 * 1440, 0)-(5.5 * 1440, 14400), vbGreen
Me.Line (2.3 * 1440, 0)-Step(20, 20000 * 1440), vbRed

'Marshall Barton via MS Community
'Me.Line (Xposition, Me.line1.Top)-(Xposition, Me.line2.Top)
Me.Line (0.3 * 1440, Me.line1.Top)-(5 * 1440, Me.line2.Top), vbGreen


End Sub

===
Is that correct?

David
 
Proposal said:
If I understand you correctly, I should have something like:


Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)

Me.ScaleMode = 1
Me.ForeColor = 0
Me.Line (5.5 * 1440, 0)-(5.5 * 1440, 14400), vbGreen
Me.Line (2.3 * 1440, 0)-Step(20, 20000 * 1440), vbRed

Me.Line (0.3 * 1440, Me.line1.Top)-(5 * 1440, Me.line2.Top), vbGreen

Well, I can't tell what you should have unless you explain
what you need more precisely. But, those three statements
seem rather odd to me. The first one draws a vertical line
5.5 inches from the left margin, starting at the very top of
the detail section and ending 10 inches down the detail
section. Since it is very unlikely that a single record's
detail section is anywhere near 10 inches high, it will be
cropped at the bottom of the detail section.

The red line is not even vertical (it slants by 20 twips)
and you specified its height at 20,000 inches, which is
ridiculous.

The third one starts 3/10 of an inch from the left margin
and at the vertical position of line1 (if that's the real
name of some horizontal(?) line). It then goes diagonally
down and to the right 4.7 inches until it reaches the top of
another horizontal(?) line named line2.

Does my description match anything like what actually
happened?
 
Thanks Marshall.

I have not been able to get any of these lines to appear in a report created
by Access 2007. That was one of my original questions - does Me.Line work in
A12? Again, my printer is PDF.

After posting my question, I tried to understand how this works by reading
The Developers Handbook (Getz et. al) and Access 2007 VBA (HF). Your reply
was more informative and so thanks a million.

Is there a detailed explanation of Me.Line somewhere? I have scrolled
through page after page in Help.

Once again, does Me.Line work in A12 for you?

Thanks. I really appreciate your time.

David
 
Also thanks for pointing out that out-of-range 20,000 inch value. Even using
huge 5-foot wide plotters, I couldn't extend a line that far. And the 22
inch maximum length for an Access control/object would be exceeded.

David
 
AFAIK, line works in A2007 but it will be some time before I
can get to my A2007 machine and try it. In the meantime, I
suggest that you eliminate a variable from the problem and
set the report to an ordinary printer and just preview the
report to see if it does something.

I seem to remember that the VBA Help topic for the Line
method is an accurate explanation of how it works. The Help
topic in A2000 through A2003 was all messed up, as if it had
been copy/pasted from some other programming language.
 
Proposal said:
I have not been able to get any of these lines to appear in a report created
by Access 2007. That was one of my original questions - does Me.Line work in
A12? Again, my printer is PDF.

OK, I finally fired up my A2007 machine and set up a sample
db table and report. I tried a couple of simple tests to
draw lines within the detail section and everything worked
as expected.

Did you get a chance to preview your report using an
ordinary printer?
 
I have a very similar issue. I am making a report that has a header and footer for the page and a details section that has anywhere from 1 line item to 30 mine-items. On this report, whether the line items equal 1 or 30, the print out is the same size (because the footer defaults to the bottom, leaving space in between the footer and details) with vertical lines running down each side of the details section.

I have tried these techniques but they will not work because the reports that have only 1 line item truncates the line I draw with the code. If I fill the entire details section with a large number of line items, the report looks fine, but if it only has 1, then I get a vertical line on either side just tall enough for the 1 record (about .22 inches high).

Does anyone have an idea about how to make this look right? I appreciate the help.



Proposal Docto wrote:

Grow Vertical Line
25-Mar-09

I have a report that is based on a government form that has several vertical
lines. One of the lines in the report needs to be pegged to a horizontal
line and to grow downward if information in one of the fields on either side
of the line increases by more than four lines. The bottom of the line needs
to stop at the intersection of another horizontal line. (I have been solving
this by opening the report in design view and extending the line manually.
That's getting old and other users won't know what to do.)

I have tried the Me.Line technique on the MS website and either I am missing
something or it doesn't work in Access 2007. Has anyone gotten Me.Line to
work with Access 2007? Is it possible to peg the bottom of a growing line to
a horizontal line?

The line is in the Detail section. The report includes a subreport. And
the report is based on a parameter query with a two table join.

Only one of the vertical lines needs to grow. None of the vertical lines in
the subreport need to grow but that would be nice in the future. And the
ultimate goal is to output to PDF, which I have working super.

Thanks.

David

EggHeadCafe - Software Developer Portal of Choice
PABZlib In-Memory ASP/ XML Compression Component
http://www.eggheadcafe.com/tutorial...b26-1b94d92fb6ac/pabzlib-inmemory-asp-xm.aspx
 
I'm not sure what the actual question is since I am using the web interface.
If you expect a line to extend vertically beyond detail sections, you should
draw the line in the On Page event of the report.
 
Back
Top