A.D.Tejpal
adtp at airtelmail.in
Thu Apr 23 00:59:56 CDT 2009
You are most welcome Rocky! And thanks for your kind observations and generous vote of confidence. Best wishes, A.D. Tejpal ------------ ----- Original Message ----- From: Rocky Smolin To: 'Access Developers discussion and problem solving' Sent: Thursday, April 23, 2009 11:14 Subject: Re: [AccessD] Variable line height A.D.: You know, after a couple responses I was going to write "Let's wait for A.D. To respond. He'll know how to do this." But I didn't want to be presumptuous. And here you are. With the solution. As always. I actually used this approach once to make some very elaborate charts and graphs in a report for a business I started with a guy about 10 years ago - drawing lines to make bar graphs. I will forward to my client. Thank you as always for your expertise and generosity. Regards, Rocky -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of A.D.Tejpal Sent: Wednesday, April 22, 2009 10:36 PM To: Access Developers discussion and problem solving Subject: Re: [AccessD] Variable line height Rocky, You can draw a vertical line spanning entire detail section by using the Line() method. Sample code in detail section's print event, as given below, will draw the desired vertical line between text boxes named Txt_1 & Txt_2. As long as the Y coordinate is set greater than dynamic height of detail section, the line will automatically fit into the available space, eliminating the scope for any possible breaks. For further refinements in drawing vertical and horizontal lines on a report in various styles, my sample db named ReportBorders might be of interest to you. It is available at Rogers Access Library. Link - http://www.rogersaccesslibrary.com/forum/forum_topics.asp?FID=45 You could adapt the underlying approach suitably, for your specific needs. Best wishes, A.D. Tejpal ------------ ' Code in report's module ' (Txt_1 & Txt_2 are the names of text boxes ' between which a vertical line is to be drawn) '================================== Private Sub Detail_Print(Cancel As Integer, _ PrintCount As Integer) Dim X As Long, Y As Long Dim GapLeft As Long, GapWidth As Long Me.ScaleMode = 1 ' Scale in Twips Me.DrawWidth = 3 ' Thickness in pixels ' Set the X value midway between the two ' text boxes (Txt_1 & Txt_2) GapLeft = Me.Txt_1.Left + Me.Txt_1.Width GapWidth = Me.Txt_2.Left - GapLeft X = GapLeft + GapWidth \ 2 ' Set Y value larger than the dynamic height of ' Detail section. (Even if Y is set much larger ' than actual dynamic height of Detail section. ' This is to prevent any possible breaks in overall ' vertical line. Only the portion that can actually ' fit in Detail section, will get drawn) Y = Me.Height + 20 ' Note: ' Me.Height gives the dynamic height of current ' section (in this case: detail section) at print time. ' Me.Detail.Height merely gives the static height ' of Detail section as per design setting. ' Draw vertical line between Txt_1 & Txt_2, so as ' to fully cover the dynamic height of Detail section. Me.Line (X, 0)-(X, Y) End Sub '===================================