Draw expanding lines in report detail

This code comes from Stephen Lebans, http://www.lebans.com/Report.htm

This code draws lines around each field in the report detail and expands with the text.


	Code:
	Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
Dim CtlDetail As Control
Dim intLineMargin As Integer

' Stephen Lebans 1999
' Stephen@ lebans.com
' www.lebans.com

' This is the spacing between the right edge of the
' control and the Vertical Seperation Line
intLineMargin = 0

' OK lets draw a vertical line to seperate each field
' for each control in details control
' If your last control on the right does not end on the edge of the section
' you will get a second vertical line. If you need to get around this then you
' can skip drawing this last Vertical Seperation Line in a couple of ways.
' We'll use the control name method Here. Our right most control is named
' TestMemo. IF current control is TestMemo - Do not print Vertical Line
For Each CtlDetail In Me.Section(acDetail).Controls
    With CtlDetail
        'If CtlDetail.name  "TestMemo" Then
        Me.Line ((.Left + .Width + intLineMargin), 0)-(.Left + .Width + _
intLineMargin, Me.Height)
        'End If
    End With
Next
    
        'While we are here lets draw a box around the Detail section
    With Me
        Me.Line (0, 0)-Step(.Width, .Height), 0, B
    End With

Set CtlDetail = Nothing

End Sub

-Ken


Post your answer or comment

comments powered by Disqus
I have two users that want different amounts of blank space between each line in the detail section of a report. Is there a way to change the area between the detail and footer programatically instead of creating 2 copies of the form, one for each user?

Thanks
Lution

I am a novice at this.

I have created a report using the Report Wizard. I re-arranged it so it consists of Member Name in the Page header, and four columns of details in the Details section with a signature in the ReportID footer section. Relationship structure is Member table related to Courses table via a link table and Instructor table realted to the Course table.

I have managed to make the appropriate horizontal lines using the Sorting and grouping function want the Report of Member Details to be contained in a table with four columns with vertical lines. How do I do this?

A report that has these items in the detail line:

LabNumber
AnalysisName
AnalysisResult
Units
Interpretation

The Interpretation is a text box whose value is dependent on what on what the value of the AnalysisName and AnalysisResult are.

i.e. If AnalysisName = Nitrate and AnalysisResult > 10 then Interpretation = "Unsafe! Treatment suggested."

Else Go on to the next set of evaluations.

I tried to do it as a function in a module named Interpretation() but that returned the same value for each line in the detail portion.

I have created a catalog using a report in access. I want to create an order
sheet that mimics the layout of the catalog to acompany the catalog for the
sales team.
I have 5 rows and 5 columns of products (in rectangular boxes) per page on the catalog. I would like to create exaclty the same layout for the order sheet but i would like to arrange them so that the first row of the first page of the catalog is in box 1.1 (column1 row 1). So it will contain 5 details ordered the same as the catalog. The next box 2.1 will have the same for the second row of the catalog. I would like to end up with column 1 as page 1 of catalog and col 2 as page 2 of catalog ect. etc.

How can create 5 items in the detail section in a box and have it go to the next detail for each and then have it continue to cycle through when the report is generated?

Or is there an easier way?

Thanks for your suggestions,
Yaac

I’m working with a data base designed for the textual analysis of Ancient Greek documents (now in its 5th year of development).

One of the problems that I have yet to resolve fully is a way to create grammatical data output (a report) in a rather unusual format.

Specifically I need to display a matrix of six different verb tenses (as column headings) and six different person-number classifications as rows.

I have figured out how to make words appear under the correct column (tense) heading. My problem is the rows (detail sections).The person-number classifications (detail records) are 1 per sing, 2 per sing, 3 per sing 1 per plu 2 per plu and 3 per plu. These classifications have already been tagged to each verb in the 400,000 item database and so it is easy enough to extract them.

My issue is this: For each verb selected for reporting I want the report to show all six person-number classifications as labels on the left-most column and the verb forms under the six tense columns. What is tricky is that I want a blank box to appear in the detail section of the report even when there is no data that matches the selection criteria for that particular verb.

My objective is to produce single page reports (for each verb) that show not only the word forms that are actually present but that will also display blank boxes where a word form WOULD BE if it existed in the text’s data base. The purpose of all this is to produce pages that are uniform in appearance.

If this is confusing, I can provide a screen shot of how the report should look.

Thanks for the help.

Rick

Hi I am trying to import word document object in the detail section of the report using an unbound data frame.
When doing this the document does not retain the look of the original document.

And is a royal pain to get to look half way right and still when printing it does not fill the page as it does in word.

Am I going about this wrong?

I really need a simpler way to get these documents into access and retain the original look.

The reason I need this is to eliminate making peel and stick labels that have to be put on these documents each and every month.
With access I just use two text boxes and a table that contains the label info which does not change from month to month but is a pain to have to peel and stick well over a hundred labels each month.

If anyone can help I really would appreciate it.

Thanks
Charles

In the detail section of my report, I recently added a second row which has only 1 text field. When the value of the textbox in the 2nd row is null, I want the total row height equal to just the first row. When the value in the textbox in the 2nd row is not null, then the total row height is equal to row 1 and 2. I tried to make the textbox in the second row invisible when it had a null value thinking that when it was null, the report would shrink to the first row height, but that didn't seem to work. I am only a beginner with VBA, but any suggestions are appreciated.
Thanks

I have a report that includes info on spans between cities. I need a way to have the ending city from the 1st line, in the report, become the beginning city for the 2nd line and so on. I know I could add another field in the Table, but, I hope I can achieve this in the report instead.

I would like to create columns in a report, but in the detail section only (allowing the Group Header control to be any size I like and to be above the detail section) Is there a way to do this? I am using both A2003 and A2007 with W7 OS.

Can you pull and ID number from each line in the Detail Section of a report to use in a SQL statement in a control of the same row?

I would like a report to underline every third record returned from its source query. If I draw a line in the detail section of the report where the records display, the line is drawn after each record. After playing with the grouping settings, I've been able to get lines drawn at seemingly random intervals, however not every third record. Any suggestions would be greatly appreciated.

- Chappy

Hi,

I have create a standard letter in within my contact database, this is to send to all my clients. But some client addressess are shorter than others, for example one would have 1 Accacia Ave, London, EC1....Whereas another client would have 2 Accacia Ave, Abbey House, London, EC1

Therefore, the four lines of the second address creates a blank line in the first address, as there is no data in that address.

I have tried IIF NULL then City (Sic), but obviously on the second line on the first address this will put London on the line where it is blank/NULL....but then how do I not show the fourth line London, as this would be duplicated with the IIFNULL, and then how do I bring the postal code up a line as well?

I have looked at Northwind, but even on there they have line spaces!!!

Can anyone point me in the Direction of solving the problem?

Afternoon all,

I'm currently designing a status report that outlines completed milestones in an ongoing project.

The situation: There are three types of milestones that need to be tracked, and as such, each column of completed milestones is separated by a line (inserted from the toolbox). Each of these lines reaches from the top of the "details" section to the bottom. Each milestone column is a subreport capturing the different types of milestones. All are bound to queries that display specific ID numbers from the milestones table.

The problem: When the "milestones" column is longer than the details section, it (as planned) pushes the details section down to accomodate the length in the report. The lines, however, do not stretch to accomodate the new length of the columns.

I've tried putting the separating line in the subreport itself, so that it will expand with the subreport; however, this only works with the longest column. The other two lines only stretch as far as their individual column.

Is there any way I can keep my column-dividing lines, going from the top of the details section to the bottom, regardless of subreport length? Any suggestions would be more than welcome. And please let me know if I've made absolutely no sense.

Many thanks.

Hi Guys; hope you're all well!!

I have a 'snaked' column report with headings and subheadings related to groups.

What I'd like to do, which sounds simple enough, is to draw vertical lines from the header to the footer section of the report, to divide the page up into something that resembles an invoice... (with vertical columns for timesing)

I have cribbed the following code from a Microsoft example, which is meant to do the trick when printing (i.e. the lines are visible in print preview)..

Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
Dim lngColor As Long

Me.ScaleMode = 3 'Pixels
Me.DrawWidth = 5 'in Pixels

lngColor = RGB(204, 204, 204)

Me.Line (0, 0)-(0, Me.ScaleHeight), lngColor
Me.Line (162, 0)-(162, Me.ScaleHeight), lngColor
Me.Line (2070, 0)-(2070, Me.ScaleHeight), lngColor
Me.Line (2775, 0)-(2775, Me.ScaleHeight), lngColor
Me.Line (3072, 0)-(3072, Me.ScaleHeight), lngColor
Me.Line (3696, 0)-(3696, Me.ScaleHeight), lngColor
Me.Line (4640, 0)-(4640, Me.ScaleHeight), lngColor

End Sub


But this only seems to include the lines in whatever section I paste it in?

So, i pasted in every section, but where the detail section doesn't reach the bottom of the page, a gap is left to the footer?!

Any help would be much appreciated. Im using Access 2010.

Thanks!

Help - need to draw a table in access using verticle lines drawn dynamically at report run time using the On-Page event.

Trouble is I don't know the verticle length in advance. I can use a verticle 'bottom' value = 18.3 to draw a line to just above my footer, but need it to stop at bottom of 'detail' section when the size of 'detail' and 'footer' are using 'can grow' = yes.

I have re-produced my feeble attempt below - can anybody tell me what I am doing wrong !

Private Sub Report_Page()
Dim asglPos(20) As Single
Dim sglTop As Single, sglBottom
'Set up Positions for Boxes
asglPos(0) = 0
asglPos(1) = 4.1
asglPos(2) = 11.5
asglPos(3) = 16.5
asglPos(4) = 24#
asglPos(5) = 26.4

If Me.Properties("acHiddenCurrentPage") = 1 Then

sglTop = (Me.Section(1).Height / 567) + 1#
Else
sglTop = 1#
End If

'sglBottom = 18.3 ' to draw to fixed footer - works OK
'but need 'dynamic' length
sglBottom = (Me.Section(acPageHeader).Height + Me.Section(acDetail).Height) / 567 + 1#

Me.DrawWidth = 1
'Always draw Vertical Lines
For intCount = 0 To 5
Me.Line (asglPos(intCount) * 567, sglTop * 567)-(asglPos(intCount) * 567, sglBottom * 567)
Next intCount
Me.Line (0, sglTop * 567)-(asglPos(5) * 567, sglTop * 567)
Me.Line (0, sglBottom * 567)-(asglPos(5) * 567, sglBottom * 567)

End sub

Any help would be appreciated !!

Thanks in advance.

I have a report that lists customer name, total product authorized, and total product on hand in the detail section. I need to know how to hide the detail line for a customer if BOTH the authorized and on hand are 0. If there is a number in either field then the line should show on the report.

This report is pulled from a query that is linked to 13 other reports so I need to make the change at the report level and not to the query.

Any suggestions?

I have 4 memo-fields - strengths,evidence,weaknesses and action. On my report I want to draw a line to seperate them: strenghts &evidence are on the top (left and right) and weaknesses& action are on the buttom (left and right).

I found some examples to draw a line but my problem is that the detial in each field are very long may be 2 pages for strenghts and evidence and 2 pages for weaknesses& action. I want to draw lines to cover all my texts not just only the first page. See the attached.

Thank you very much!

i have a report in which i am drawing vertical lines between diffrent columns. In the end a horizontal line should come (I HAVE THAT IN IN PAGE FOOTER).nOW THE PROBLEM IS THAT HOW TO DRAW VERTICAL LINE FROM PAGE HEADER TO PAGE FOOTER?? I TRIED IT BUT SOMETIME IT TOUCHES PAGE FOOTER SOMETIMES JUST HALF WAY.

my cODE LIKE THIS :

Drawline Me.Text20.Left, thick_line

Private Sub Drawline(leftcord As Single, thickness As Integer)
Dim bottomcord As Single
Dim color As Long
bottomcord = 22 * 1480
color = RGB(0, 0, 0)
Me.DrawMode = 1
Me.DrawWidth = thickness
Me.DrawStyle = 0
Me.Line (leftcord, 0)-(leftcord, bottomcord), color
End Sub

I WANT INSTEAD OF GIVING BOTTOM CORD AS STATIC VALUE IT SHOULD BE TILL PAGE FOOTER.

HOW TO DO THIS??
SHIKHA

This has to be the most complicated problem I have ever had with reports in Access and it is a problem that has plagued me for years. I am hoping someone can help me out with this one.

I am trying to print an invoice. For each of the fields in the detail section I want to separate them with a line. I have used the following code to create a verticle line running from the top of the detail section to the bottom which ends when it gets to the last record in the detail section.


	Code:
	Dim Color As Long

    Me.ScaleMode = 5
    Me.DrawWidth = 0
    Color = RGB(128, 128, 128)
    Me.Line (0.125, 0)-(0.125, 22), Color
    Me.Line (7.9583, 0)-(7.9583, 22), Color

The problem is that the invoice totals (subtotal, taxes, grand total etc.) are calculated in the page footer which appears at the bottom of the report and there is a big blank space between where the detail section ends and the page footer starts. Below is an example.



I have checked and when the report jumps to more than 1 page the detail continues on the second page as normal, and the vertical lines end when the data ends. As you can see the detail section could end at any point on any page so I am thinking the way to do it is to use a group footer (which falls between the detail section and page footer) and change the height of it dynamically to calulate the distance from the bottom of the detail section to the top of the page footer and set that as the height of the group footer.

I have tried everything under the sun to make that space fill in with something and to no avail. Any help would be greatly appreciated!!

Sean Lannigan
IT Administrator
Hetek Solutions Inc.

I need to reduce space between lines in a custom paper size report that I need to create for a label.

My report custom paper size is 5.75 Inch x 1.75 Inch and the filed is

Font Name: Times New Roman
Font Size: 6
Can Grow: Yes
Can shrink: Yes

Section Detail Height: 0.0833" --- Reducing this value dose not reduce the space between lines

I tried VBA Private Sub Report_Open(Cancel As Integer)

Me.Detail.Height = 3

and
rpt.Section(acDetail).Height = 10

but could not reduce the space between lines.

When I open the report I can see that there is space between lines that can be reduce ( I just need a hair line space between two lines)

Dose any one know how to fix this problem


Thanks
Rahul

Hi,

I am trying to design a report and want to line up the vertical borders in the detail with those of the header. Is there any way you can zoom in so you can get them precisely in line? The column widths across the report are different. I know I can snap to grid but some of my borders arent on the grid.

Thanks.

I am using something similar to the following in report & a module to draw a elipse around a field. I want to increase the thickness of the line but have had problems. I've fiddled with drawwidth without success. Any suggestions?


Private Sub Detail_Format(ByRef intCancel As Integer, _
ByRef intFormatCount As Integer)


If Me.txtXYX > 500 Then
HighlightControl Me.txtXYZ, vbRed, 0.35
End If


Module


Option Explicit
Option Compare Text


Public Sub HighlightControl(ByRef ctlControl As Control, _
ByVal lngColour As Long, _
ByVal sngAspect As Single)

With ctlControl
' Remove the current border.
.BorderStyle = 0

' Draw the ellipse.
.Parent.Circle (.Left + .Width / 2, _
.Top + .Height / 2), _
.Width / 2 + 50, _
lngColour, , , _
sngAspect
End With

End Sub

Hi, I have a report which has a few headers:

1. A static area on the top with company info, etc.
2. A details section for product info.
3. A static area on the bottom with some basic info.

I'm trying to draw a single border and some lines which extends throughout the entire report page; however, the program will not let me do this. Instead, it only allows me to draw a line or border WITHIN each section, in effect not allowing me to extend it straight through multiple sections of the report. Can anyone shed some light on this? Thanks so much!!

This one is driving me nuts!

I have an invoice report, F101Invoices, with 2 subreports. Basic company info is in the report header with client name in page header.

At the top of the detail section I have an array of information related to any specific job such as JobID, FundID, EmpId, AudID, various dates and some other stuff.

The first subreport, F101Invoices_sRpt, which contains line-item detail of the billable charges, including any expenses, is contained in the detail section just below the varied information explained above. The second subreport, F101Invoices_ExpsRpt, is a detailed line-item expense type report and is contained in the report footer. Both subreports are linked to F101Invoices by JobID.

If a job has expenses, the report displays and prints out correctly, no problem. However if a job doesn't have any expenses, nothing prints or displays, other than the header and some static information at the top of the detail section even though there are billable fees. I placed the following code in F101Invoices.Detail OnFormat event:

Option Compare Database
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
If Me.F101Invoices_ExpsRpt.Report.HasData = True Then
Me.ReportFooter.Visible = True
Else
Me.ReportFooter.Visible = False
End If
End Sub

This layout technique and the above code are an exact copy of what I use in my time card reports. There are actually 2 subreports in the report footer of time cards, both related to expenses. One subreport is total expense, the second provides information on company paid expenses with a formula calculating reimburseable expenses. If there are no expenses for the pay period, the code above, applicable to the time card, hides the footer so that a blank page doesn't print yet it allows for the detail of all billable hours by job to print or display.

I have JobID (linked fields) in detail section of the invoices. I've tried putting in the page header (this is where the linked field resides in the time card) but this doesn't work either.

Spent the entire weekend getting a couple of issues fixed and working in this beast, a very good portion on this particular issue. Anyone got some ideas? I've got to get to bed before 2 in the morning see as how I have to go to work tomorrow!


Not finding an answer? Try a Google search.