broken horizontal line

  • Thread starter Thread starter stephm
  • Start date Start date
S

stephm

Hi. I'm trying to create a report that essentially has 4
columns (there's no data in the columns, I just want the
lines for people to write on the report). This is an
auction form where people up the bid and leave their
personal information.

For example ("dashes" should be a solid line)

Date Price Name Number
---- ------ ------ ------ (call this the line row)

And I would like this line row to appear down the entire
page.

I'm a report wizard kind of gal. I've copied and pasted
the line row (sad, I know) and it's difficult to get the
spacing between rows consistent. So I'm sure there must
be code to do this. Any suggestions? Details very much
appreciated. Steph
 
You might want to modify the following code that draws the lines using the
Line method.

Private Sub Report_Page()
Dim intNumLines As Integer
Dim intLineNum As Integer
Dim intDetailHeight As Integer
Dim intPageHeadHeight As Integer
On Error GoTo Report_Page_Error

intNumLines = 30
intDetailHeight = Me.Section(acDetail).Height
intPageHeadHeight = Me.Section(3).Height
For intLineNum = 1 To intNumLines
Me.CurrentY = (intLineNum - 1) * intDetailHeight + intPageHeadHeight
Me.CurrentX = 0
Me.FontBold = True
Me.FontSize = 14
Me.Print intLineNum 'print the line number
Me.Line (0, intPageHeadHeight + intLineNum * intDetailHeight)- _
Step(Me.Width, 0)
Next

On Error GoTo 0
Exit Sub

Report_Page_Error:
Select Case Err
Case 2462 'no page header
intPageHeadHeight = 0
Resume Next
End Select
MsgBox "Error " & Err.Number & " (" & Err.Description & _
") in procedure Report_Page of VBA Document Report_Report1"

End Sub
 
Thanks. It looks very fancy and I have no idea what it
means, but I look forward to figuring it out! Thanks,
Steph
 
Create a table with four text fields and one record. In the record, each
field needs the value "----------". Create another table with one field
named Number. Fill that field with the numbers 1 to the number of lines you
want on your report. Create a query that includes both tables. There will be
no join lines. Only include the four text fields in your query. Base your
report on this query and your report will have the same number of line rows
as your highest number in your number table.
 
I thought when you stated "I'm a report wizard kind of gal" that it meant
you were awesome at creating reports. Now I assume it means you use the
wizard.... ;-(
 
Interesting. Except I do have data fields on the report
header so my report is already based on a query. Thanks,
Steph
 
I thought I was bad a coding. And then I learned there
was report coding as well. I'm really bad at that.

When I used the code I got "Error 6 (Overflow) in
procedure Report_Page of VBA Document Report_Report1" and
it printed a big "1", then lower down a solid black line
across the page, than a big "2". I was planning to use
smaller paper so my report is 4.6" across.

Copy and Paste it is! Thanks.
 
The code I suggested created lines where the distance between was equal to
the height of the detail section.
intDetailHeight = Me.Section(acDetail).Height
You may want to change this to:
intDetailHeight = 720 'this would be 1/2 inch

You may also want to change the number of lines in the following code
intNumLines = 30

If you don't want to print line numbers, comment out
' Me.Print intLineNum 'print the line number

If you want four separate lines across horizontally
Me.Line (0, intPageHeadHeight + intLineNum * intDetailHeight)- _
Step(1000, 0)
Me.Line (1200, intPageHeadHeight + intLineNum * intDetailHeight)- _
Step(1000, 0)
Me.Line (2200, intPageHeadHeight + intLineNum * intDetailHeight)- _
Step(1000, 0)
Me.Line (3200, intPageHeadHeight + intLineNum * intDetailHeight)- _
Step(1000, 0)
Change the left position of each line by changing the first number following
"Me.Line ("
Change the length of each line by changing the first number following
"Step("
 
Back
Top