Hi,
My form is based on a SharePoint list and contains a field called UKCRNID (in SharePoint this is set as a number with 0 decimal places.) My form also contains a label called ViewPortfolioDatabase and I want this label to be a hyperlink, which will change with the value in UKCRNID.
E.g. if I'm looking at UKCRNID 12345, then the hyperlink should be http://public.ukcrn.org.uk/Search/StudyDetail.aspx?StudyID=12345 In some cases the UKCRNID will be null and in that case I don’t want the label to be a hyperlink.
I’ve read some other threads and I *think* I’m fairly close with this. But have I left something important out of the following code, or attached it to the wrong event, or what? The error is “Run time error 424 Object required” and highlights the "If" line when it breaks.
Do I need to complete the Hyperlink Address or Hyperlink SubAddress properties in the properties pane? I haven't, as I'm assuming the code will handle that.
Thank you.
My form is based on a SharePoint list and contains a field called UKCRNID (in SharePoint this is set as a number with 0 decimal places.) My form also contains a label called ViewPortfolioDatabase and I want this label to be a hyperlink, which will change with the value in UKCRNID.
E.g. if I'm looking at UKCRNID 12345, then the hyperlink should be http://public.ukcrn.org.uk/Search/StudyDetail.aspx?StudyID=12345 In some cases the UKCRNID will be null and in that case I don’t want the label to be a hyperlink.
I’ve read some other threads and I *think* I’m fairly close with this. But have I left something important out of the following code, or attached it to the wrong event, or what? The error is “Run time error 424 Object required” and highlights the "If" line when it breaks.
Code:
Private Sub ViewPortfolioDatabase_Click()
Dim StudyLink As String
If Me.UKCRNID.Value Is Not Null Then
Me.ViewPortfolioDatabase.HyperlinkAddress = "http://public.ukcrn.org.uk/Search/StudyDetail.aspx?StudyID=" & Me.UKCRNID
Me.ViewPortfolioDatabase.Visible = True
Else
Me.ViewPortfolioDatabase.Visible = False
End If
Application.FollowHyperlink StudyLink
End Sub
Do I need to complete the Hyperlink Address or Hyperlink SubAddress properties in the properties pane? I haven't, as I'm assuming the code will handle that.
Thank you.