P
PC User
I'm trying to make a function that creates a watermark on an access
report. I have A2K and the function is to be called when a report is
openned. Call Watermark(Me). I almost have it working, but I get an
error "You entered an expression that has an invalid reference to the
property ScaleMode." I can't find what is wrong. Can someone help
me?
==========================================
Public Function Watermark(rpt As Report)
Dim strMessage As String
Dim lngHorSize As Long
Dim lngVerSize As Long
Debug.Print rpt.Name
strMessage = "DRAFT"
With rpt
'Set scale to pixels, and set FontName and
'FontSize properties.
..ScaleMode = 3
..FontName = "Courier"
..FontSize = 48
..ForeColor = 12632256
' Horizontal width.
lngHorSize = .TextWidth(strMessage)
' Vertical height.
lngVerSize = .TextHeight(strMessage)
' Calculate location of text to be displayed.
..CurrentX = (.ScaleWidth / 2) - (lngHorSize / 2)
..CurrentY = (.ScaleHeight / 2) - (lngVerSize / 2)
' Print text on Report object.
..Print strMessage
End With
End Function
==========================================
Thanks,
PC
report. I have A2K and the function is to be called when a report is
openned. Call Watermark(Me). I almost have it working, but I get an
error "You entered an expression that has an invalid reference to the
property ScaleMode." I can't find what is wrong. Can someone help
me?
==========================================
Public Function Watermark(rpt As Report)
Dim strMessage As String
Dim lngHorSize As Long
Dim lngVerSize As Long
Debug.Print rpt.Name
strMessage = "DRAFT"
With rpt
'Set scale to pixels, and set FontName and
'FontSize properties.
..ScaleMode = 3
..FontName = "Courier"
..FontSize = 48
..ForeColor = 12632256
' Horizontal width.
lngHorSize = .TextWidth(strMessage)
' Vertical height.
lngVerSize = .TextHeight(strMessage)
' Calculate location of text to be displayed.
..CurrentX = (.ScaleWidth / 2) - (lngHorSize / 2)
..CurrentY = (.ScaleHeight / 2) - (lngVerSize / 2)
' Print text on Report object.
..Print strMessage
End With
End Function
==========================================
Thanks,
PC