Printing an Invoice

G

Guest

Hi,

I'm using Access2K

I would like to be able to print an invoice using a header, detail and
footer. My problem is focused on the detail portion that prints out 2 line
items but can't print the empty lines (formats) leading to the footer.

Ex:

ABC Invoice # 123
Cust: cde
Addr: 123 Main
|-----------------------------------------|
|# Description $ |
|-----------------------------------------|
| 2 | paper clips | .10 |
-------------------------------------------|
| 5 | paper |1.20 |
|-----------------------------------------|


<20 lines of spaces without format lines>


|------------------------------------------|
Subt: $1.30
tax: .12
Total: $1.42

Is there any way to print the format lines regardless of the number of line
items that are printed on the invoice or to suppress the space leading to the
footer?

Your help would be greatly appreciated.

TD
 
G

Guest

You can use the Line method in the On Page event of the report.
Private Sub Report_Page()
Dim intNumLines As Integer
Dim intLineNumber As Integer
Dim intTopMargin As Integer
Dim ctl As Control
Dim intLineHeight As Integer

intNumLines = 20
intTopMargin = Me.Section(3).Height
intLineHeight = Me.Section(0).Height
For Each ctl In Me.Section(0).Controls
For intLineNumber = 0 To intNumLines - 1
Me.Line (ctl.Left, intTopMargin + _
(intLineNumber * intLineHeight)) _
-Step(ctl.Width, intLineHeight), , B
Next
Next
End Sub
 
R

Rob Parker

A possible alternative to Duane's posting may be to use a group
header/footer (based on Invoice Number) rather than the page header/footer
(which is what I suspect you are currently using). This will position the
footer immediately below the detail section, rather than at the bottom of
the page.

HTH,

Rob
 
G

Guest

Duane,

Thank you for the excellent response. I was able to change the line number
to match my invoice (the sample had a fictitious number).

Given the example I've provided, you've answered it very well.

I still have a problem that I hope you will be able to help me. I do have
some hidden controls that I use as counters and the logic you have provided
causes lines for those as well. In addition, the lines I use in the detail
sections are difficult to match (single/double line, dotted/full, width,
etc..) to the ones you've provided. Is there a way to either use the Line
option in the detail section or alternately, is there a method to use the
grahics (used in detail section) in the on-page event?

Many thanks!!
 
G

Guest

Sorry ... correction to my previous post for addition problem.

I should have said it was difficult to match the lines from my header
section .. rather than the detail section.
 
G

Guest

You should be able to ignore hidden controls in the code.
For Each ctl In Me.Section(0).Controls
If ctl.Visible = True Then
For intLineNumber = 0 To intNumLines - 1
Me.Line (ctl.Left, intTopMargin + _
(intLineNumber * intLineHeight)) _
-Step(ctl.Width, intLineHeight), , B
Next
End If
Next
You can set the line styles and possibly draw two lines to get double.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top