Fixed record in report details section (1 Viewer)

elementpr

New member
Local time
Today, 10:35
Joined
Mar 18, 2016
Messages
3
Hi
I have an official report that has a determined number of rows, 25 to be precise. I did create the report with the correct space and everything. Included the code of adding blank line to the detail section of the report. The problem is that there is a column with the fix numbers and I can find a way to create that. Since always have to have a count of 25 rows, regardless of the rows filled.

This is the code that I used to fill the detail section of the report
Private Sub Report_Page()
Dim intRows As Integer
Dim intLoop As Integer
Dim intTopMargin As Integer
intRows = 25
intDetailHeight = Me.Section(0).Height
intTopMargin = 360
For intLoop = 0 To intRows
Me.CurrentX = 20
Me.CurrentY = intLoop * intDetailHeight + intTopMargin
Me.Line (0, intLoop * intDetailHeight + intTopMargin)- _
Step(Me.Width, intDetailHeight), , B
Next
End Sub

Thanks for the help
 

JHB

Have been here a while
Local time
Today, 15:35
Joined
Jun 17, 2012
Messages
7,732
What is the exact problem, could you show a printscreen of that?
 

elementpr

New member
Local time
Today, 10:35
Joined
Mar 18, 2016
Messages
3
Hi JHB

Thanks for the reply, in the photo I attached is what I want to do. The left one is the original document and in the right is the one I'm making. I want to have the same fixed number appear regardless of the rows that have information. Hope the photo can explain better.
 

Attachments

  • 2016-03-21 10.05.52.jpg
    2016-03-21 10.05.52.jpg
    113.2 KB · Views: 194

JHB

Have been here a while
Local time
Today, 15:35
Joined
Jun 17, 2012
Messages
7,732
The problem is you can't create controls (labels) on the fly like you do with the lines.
One solution would be to put the data into a table, and use that table for the recordsource for the report.
Use a recordset to fill in the data + number from 1 to 50 or more, (must always be a multiple of 50), depending of how many records the data fills.
For helping you further, I need a sample database with the report and some data.
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 21:35
Joined
May 7, 2009
Messages
19,233
manually print the numbers using your Report_Page event:

rivate Sub Report_Page()
Dim intRows As Integer
Dim intloop As Integer
Dim intDetailHeight As Integer
Dim intetopmargin As Integer
Dim intTopMargin As Integer
Dim i As Integer
Dim j As Integer
intRows = 25
intDetailHeight = Me.Section(0).Height
intTopMargin = 360
i = 1
j = 26

For intloop = 0 To intRows
If intloop > 0 Then
Me.CurrentX = 30
Me.CurrentY = intloop * intDetailHeight + intTopMargin + 100
Me.Print i
Me.CurrentX = 1044 * 5 '5 INCHES
Me.CurrentY = intloop * intDetailHeight + intTopMargin + 100
Me.Print j
i = i + 1
j = j + 1
End If

Me.CurrentX = 20
Me.CurrentY = intloop * intDetailHeight + intTopMargin
Me.Line (0, intloop * intDetailHeight + intTopMargin)- _
Step(Me.Width, intDetailHeight), , B

Next
End Sub


'///////////////////

adjust Me.CurrentX as necessary.
 

elementpr

New member
Local time
Today, 10:35
Joined
Mar 18, 2016
Messages
3
JHB I can't upload a sample db since it's a db from my work and it has sensitive information :(

but I uploaded some pics of the code that I have now and modified from what arnelgp wrote and the results it gave me in the print version.

I'm I would be happy if a I can make blank record that can be counted and fill the page.

I would try to work with this code and see if I have luck on working.
Public Function getnumberofBlanks() As Integer
Dim recordCount As Integer
Dim N As Integer
recordCount = DCount("*", Me.OC)
If recordCount <= 16 Then
getnumberofBlanks = 16 - recordCount
Else
N = 1
Do while N * 21 + 16 <= recordCount
N = N + 1
Loop
getnumberofBlanks = (N * 21 + 16) - recordCount
End If
End Function

Public Sub printBlankRecords(numberBlanks As Integer)
Dim recordCount As Integer
recordCount = DCount("*", Me.OC)
TotalCount = TotalCount + 1

If TotalCount = recordCount Then
Me.NextRecord = False
'once you get to the last record, stay on last record
ElseIf TotalCount > recordCount And TotalCount < (recordCount + numberBlanks) Then
Me.NextRecord = False
'make the font and backcolor the same appearing to be empty record
Me.Equipment.ForeColor = Me.Equipment.BackColor
Me.Item.ForeColor = Me.Item.BackColor
End If
End Sub Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
printBlankRecords getnumberofBlanks
End Sub

If there's any suggestions I'm greatly appreciated
 

Attachments

  • 2016-03-28 16.22.57.jpg
    2016-03-28 16.22.57.jpg
    82.5 KB · Views: 193
  • 2016-03-28 16.23.39.jpg
    2016-03-28 16.23.39.jpg
    76.4 KB · Views: 188
  • 20160328_153231-1.jpg
    20160328_153231-1.jpg
    100.1 KB · Views: 190

Users who are viewing this thread

Top Bottom