Linking Code

CrostonScottish

New member
Local time
Today, 20:51
Joined
Oct 30, 2007
Messages
6
Anybody help me with some code that i am having difficulties with?

I have found some code for sample reports produced by microsoft which i would like to use in a report in my database.

One code is to "Draw vertical lines in a report that can grow" with the event procedure on the detail section as:
PHP:
Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
   Me.ScaleMode = 1
   Me.ForeColor = 0
   'Repeat the following line of code for each vertical line
   ' 1*1440 represents 1 inch
   Me.Line (0 * 1440, 0)-(0 * 1440, 14400) 'Draws line at Left Margin
   Me.Line (1 * 1440, 0)-(1 * 1440, 14400) 'At 1 inch
   Me.Line (1.9 * 1440, 0)-(1.9 * 1440, 14400) 'At 2 inch
   Me.Line (5.5 * 1440, 0)-(5.5 * 1440, 14400) 'At 3 inch
   
   
   'the 14400 is an arbitrary number to increase the line to the max of a
   'section.
End Sub

The other code is "To print a constant number of lines" which uses the OnPrint =PrintLines([Reports]![Rpt How To Print a Constant Number of Lines Per Group],[TotGrp]) in the detail section:
PHP:
Call the SetCount() function from the group header section's
' OnPrint property using the syntax: =SetCount(Report)

' Call the PrintLines() function from the detail section's OnPrint
' property using the syntax: =PrintLines(Report,[TotGrp]).

      Function PrintLines(R As Report, TotGrp)
         TotCount = TotCount + 1
         If TotCount = TotGrp Then
              R.NextRecord = False
         ElseIf TotCount > TotGrp And TotCount < 15 Then
              R.NextRecord = False
              R![ProductName].Visible = False
         End If
      End Function

Is there any way i can combine this code in one event procedure or function? Very new to VBA so any help would be great.
 

Users who are viewing this thread

Back
Top Bottom