How can I draw a horizontal line using code?
I have the following that puts the Reference and Element details into the report, but it's a horizontal line that I want...
I've looked at:
expression.Line(flags, x1, y1, x2, y2, color)
and the example:
From that, I put this into the if statement (which works!)above:
It doesn't let me preview the report. it flashes and goes back into the design view.
I also tried changing the line:
into
same thing happens...
Any help would be appreciated
Aubs
I have the following that puts the Reference and Element details into the report, but it's a horizontal line that I want...
Code:
If Right(Me.Ref.Value, 2) = "zz" Then
Me.FontBold = True
Me.CurrentX = 200
Me.CurrentY = 500
Me.Print (Left(Me.Ref.Value, 1))
Me.CurrentX = 800 - 0
Me.CurrentY = 500 - 0
Me.Print (Element)
End If
expression.Line(flags, x1, y1, x2, y2, color)
and the example:
Code:
Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
' Call the Drawline procedure
DrawLine
End Sub
Sub DrawLine()
Dim rpt As Report, lngColor As Long
Dim sngTop As Single, sngLeft As Single
Dim sngWidth As Single, sngHeight As Single
Set rpt = Reports!EmployeeReport
' Set scale to pixels.
rpt.ScaleMode = 3
' Top inside edge.
sngTop = rpt.ScaleTop + 5
' Left inside edge.
sngLeft = rpt.ScaleLeft + 5
' Width inside edge.
sngWidth = rpt.ScaleWidth - 10
' Height inside edge.
sngHeight = rpt.ScaleHeight - 10
' Make color red.
lngColor = RGB(255,0,0)
' Draw line as a box.
rpt.Line(sngTop, sngLeft) - (sngWidth, sngHeight), lngColor, BEnd Sub
From that, I put this into the if statement (which works!)above:
Code:
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
If Right(Me.Ref.Value, 2) = "zz" Then
Me.FontBold = True
Me.CurrentX = 200
Me.CurrentY = 500
Me.Print (Left(Me.Ref.Value, 1))
Me.CurrentX = 800 - 0
Me.CurrentY = 500 - 0
Me.Print (Element)
Dim rpt As Report, lngColor As Long
Dim sngTop As Single, sngLeft As Single
Dim sngWidth As Single, sngHeight As Single
Set rpt = Reports!EmployeeReport
' Set scale to pixels.
rpt.ScaleMode = 3
' Top inside edge.
sngTop = rpt.ScaleTop + 5
' Left inside edge.
sngLeft = rpt.ScaleLeft + 5
' Width inside edge.
sngWidth = rpt.ScaleWidth - 10
' Height inside edge.
sngHeight = rpt.ScaleHeight - 10
' Make color red.
lngColor = RGB(255, 0, 0)
' Draw line as a box.
rpt.Line (sngTop, sngLeft)-(sngWidth, sngHeight), lngColor, B
End If
End Sub
It doesn't let me preview the report. it flashes and goes back into the design view.
I also tried changing the line:
Code:
rpt.Line (s
Code:
Me.Line (s
same thing happens...
Any help would be appreciated
Aubs