Sub CreateHyperlinkLabel(strForm As String, xPos As Integer, _
yPos As Integer, strCaption As String, Optional strAddress As String, _
Optional strSubAddress As String)
Dim ctlLabel As Control
' Open Form, hidden In Design view.
DoCmd.OpenForm strForm, acDesign,,,,acHidden
' Create label Control With text specified By strCaption, at
' the position specified By xPos And yPos.
Set ctlLabel = CreateControl(strForm, acLabel, , "", _
strCaption, xPos, yPos)
' Set hyperlink address, text color, And underline.
With ctlLabel
.HyperlinkAddress = strAddress
.HyperlinkSubAddress = strSubAddress
.ForeColor = "1279872587"
.FontUnderline = True
End With
' Save form.
DoCmd.Save acForm, strForm
End Sub
Copyright By AccessVision
|