Report in a particular formated mode

  • Thread starter Diego via AccessMonster.com
  • Start date
D

Diego via AccessMonster.com

Hi
i need to write a report with 18 lines (maximum) even if the line is empty

I want a report like this

Number Name Address City fieldx ....
1 Diego Street1 NY xxxx
2 Pippo Street2 NY xxxx
.....
18 Popo Street18 Ny xxxx

If the records are 18 no problem, but if the record are less then 18, i want
the same number of line (18) with empty fields. The result with only one
record should be :

Number Name Address City fieldx ....
1 Diego Street1 NY xxxx
2
.....
18

All lines are empty except the first.
All the others are empty with only the number of line.
thank you in advance for your help

Diego
 
M

Marshall Barton

Diego said:
i need to write a report with 18 lines (maximum) even if the line is empty

I want a report like this

Number Name Address City fieldx ....
1 Diego Street1 NY xxxx
2 Pippo Street2 NY xxxx
....
18 Popo Street18 Ny xxxx

If the records are 18 no problem, but if the record are less then 18, i want
the same number of line (18) with empty fields. The result with only one
record should be :

Number Name Address City fieldx ....
1 Diego Street1 NY xxxx
2
....
18

All lines are empty except the first.
All the others are empty with only the number of line.


If you do not already have a running sum text box for the
number, add it. Name it txtNumber aand set its expression
to -1 and RunningSum to Over All.

Add a variable declaration to the top of the report's
module:
Private LastDetail As Long
and add a line of code to the detail section's Print event
procedure:
LastDetail = Me.Top

Then use some code in the report's Page event procedure:
Dim K As Long
For K = 1 To 18 - txtNumber
Me.CurrentX = 0
Me.CurrentY = LastDetail + K * Me.Section(0).Height
Print txtNumber + K
Next K
 
D

Diego via AccessMonster.com

Hi
it is not completely clear.
i have done all, but i do not understand where is the top of the report's
module ?
I need to click on in the left corner of the report (design view )?
Sorry for that
Diego

Marshall said:
i need to write a report with 18 lines (maximum) even if the line is empty
[quoted text clipped - 18 lines]
All lines are empty except the first.
All the others are empty with only the number of line.

If you do not already have a running sum text box for the
number, add it. Name it txtNumber aand set its expression
to -1 and RunningSum to Over All.

Add a variable declaration to the top of the report's
module:
Private LastDetail As Long
and add a line of code to the detail section's Print event
procedure:
LastDetail = Me.Top

Then use some code in the report's Page event procedure:
Dim K As Long
For K = 1 To 18 - txtNumber
Me.CurrentX = 0
Me.CurrentY = LastDetail + K * Me.Section(0).Height
Print txtNumber + K
Next K
 
M

Marshall Barton

Diego said:
it is not completely clear.
i have done all, but i do not understand where is the top of the report's
module ?
I need to click on in the left corner of the report (design view )?


Open the report in design view. Use the View menu - Code
item to open the Visual Basic Editor with the report's
module.

At the top left in the VBE module's window, select (General)
in the drop list. Select {Declarations) in the drop list at
the top right. You should then see the line
Option Compare Database
as the first line in the module. Make sure the next line is
Option Explicit
Add the line I posted after that.
 
D

Diego via AccessMonster.com

Ok
to have the correct number 1 to 18 but i have modified the txtNumber = 1 to
have the correct counter. The strange thing is that the list is not in the
correct position. The list of empty lines from 2 to 18 are superimposed to
the first line, while it should be after the first line.
I have tried with only one line to test if works fine.

Any idea ?

Diego
 
D

Diego via AccessMonster.com

I have fouded a little error during code rewritting.
Now the position is better, but not completely correct.
the report is like this. The numbers from 2 to 18 that are empty are not in
line with the first line and also the botton distance is different.

1 xxxxxx E Lasagna Diego


2
3
4
5
6
7
8
9
10


diego
Ok
to have the correct number 1 to 18 but i have modified the txtNumber = 1 to
have the correct counter. The strange thing is that the list is not in the
correct position. The list of empty lines from 2 to 18 are superimposed to
the first line, while it should be after the first line.
I have tried with only one line to test if works fine.

Any idea ?

Diego
[quoted text clipped - 12 lines]
Option Explicit
Add the line I posted after that.
 
M

Marshall Barton

Diego said:
I have fouded a little error during code rewritting.
Now the position is better, but not completely correct.
the report is like this. The numbers from 2 to 18 that are empty are not in
line with the first line and also the botton distance is different.

1 xxxxxx E Lasagna Diego


2
3
4
5
6
7
8
9
10


Getting the numbers to line up is a problem. It's easy to
add some spaces before the number, but I don't see how to
get the right side to line up when you are using a
proportional font. How about changing the number text box
to left alignment?

I'll need to see a Copy/Paste of the code you used to see if
I can figure out why there's a gap between the 1st and 2nd
lines.
 
D

Diego via AccessMonster.com

Option Compare Database
Option Explicit
Private LastDetail As Long

Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
LastDetail = Me.Top
End Sub

Private Sub Report_Page()
Dim K As Long
For K = 1 To 18 - txtNumber
Me.CurrentX = 0
Me.CurrentY = LastDetail + K * Me.Section(0).Height
Print txtNumber + K
Next K
End Sub


then a textbox with Name = txtNumber
control source =1
running sum=over all

Ciao
Diego




Marshall said:
I have fouded a little error during code rewritting.
Now the position is better, but not completely correct.
[quoted text clipped - 12 lines]

Getting the numbers to line up is a problem. It's easy to
add some spaces before the number, but I don't see how to
get the right side to line up when you are using a
proportional font. How about changing the number text box
to left alignment?

I'll need to see a Copy/Paste of the code you used to see if
I can figure out why there's a gap between the 1st and 2nd
lines.
 
M

Marshall Barton

Diego said:
Option Compare Database
Option Explicit
Private LastDetail As Long

Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
LastDetail = Me.Top
End Sub

Private Sub Report_Page()
Dim K As Long
For K = 1 To 18 - txtNumber
Me.CurrentX = 0
Me.CurrentY = LastDetail + K * Me.Section(0).Height
Print txtNumber + K
Next K
End Sub
I think it's the top page margin that is the difference
between where Me.Top starts its measurement and where
CurrentY starts.

I can never remember which things have their 0 at the top of
the paper and which ones have their 0 at the top of the
printable area :-( Try changing the line to:

Me.CurrentY = LastDetail + K * Me.Section(0).Height -
Me.Printer.TopMargin
 
D

Diego via AccessMonster.com

ok
it is works
Thank you
Diego

Marshall said:
Option Compare Database
Option Explicit
[quoted text clipped - 12 lines]
Next K
End Sub

I think it's the top page margin that is the difference
between where Me.Top starts its measurement and where
CurrentY starts.

I can never remember which things have their 0 at the top of
the paper and which ones have their 0 at the top of the
printable area :-( Try changing the line to:

Me.CurrentY = LastDetail + K * Me.Section(0).Height -
Me.Printer.TopMargin
 

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