Create dynamic active hyperlinks in Access VBA
Solved
artamys
Posted messages
122
Registration date
Status
Member
Last intervention
-
CaPiT Posted messages 622 Status Member -
CaPiT Posted messages 622 Status Member -
Hello,
I am working on an application.
I have a table that has a field which is a hyperlink to the web, more specifically an intranet.
I have a form.
Depending on certain criteria, I display the characteristics of such or such request with a hyperlink provided in a field.
My problem is that the hyperlink is in a text box loaded from VBA and clicking on it has no effect. However, it is indeed a hyperlink.
ISHyperlink: Yes.
Locked: No
Enabled: Yes.
I don't understand.
At worst, I would need to replace this display with a macro that opens a web page and pastes the hyperlink line from the table. Does anyone have a program or know the VBA correspondence for the hyperlink address property?
Thank you and have a nice day.
I am working on an application.
I have a table that has a field which is a hyperlink to the web, more specifically an intranet.
I have a form.
Depending on certain criteria, I display the characteristics of such or such request with a hyperlink provided in a field.
My problem is that the hyperlink is in a text box loaded from VBA and clicking on it has no effect. However, it is indeed a hyperlink.
ISHyperlink: Yes.
Locked: No
Enabled: Yes.
I don't understand.
At worst, I would need to replace this display with a macro that opens a web page and pastes the hyperlink line from the table. Does anyone have a program or know the VBA correspondence for the hyperlink address property?
Thank you and have a nice day.
Configuration: Windows XP Internet Explorer 6.0
5 answers
Hello, your problem is quite complicated.
At worst, you can make an INSERT TO request to send the link from VBA to your table (format: hyperlink).
Then you display a text box that takes the link inserted in your table field.
At worst, you can make an INSERT TO request to send the link from VBA to your table (format: hyperlink).
Then you display a text box that takes the link inserted in your table field.
found !!!!
Sub TextURLDEI_Click()
Dim Base_modifProjet As DAO.Recordset
Set db = CurrentDb()
Set Base_modifProjet = db.OpenRecordset("TB_DEI")
Base_modifProjet.Index = "primarykey"
Base_modifProjet.Seek "=", ListeNumDEI
If IsNull(Base_modifProjet("URLDEI")) Then Message = "No link registered for this DEI. Please create it."
If IsNull(Base_modifProjet("URLDEI")) Then MsgBox (Message)
If IsNull(Base_modifProjet("URLDEI")) Then Exit Sub
TextURLDEI.HyperlinkSubAddress = Base_modifProjet("URLDEI")
TextURLDEI.HyperlinkAddress = Base_modifProjet("URLDEI")
End Sub
Sub TextURLDEI_Click()
Dim Base_modifProjet As DAO.Recordset
Set db = CurrentDb()
Set Base_modifProjet = db.OpenRecordset("TB_DEI")
Base_modifProjet.Index = "primarykey"
Base_modifProjet.Seek "=", ListeNumDEI
If IsNull(Base_modifProjet("URLDEI")) Then Message = "No link registered for this DEI. Please create it."
If IsNull(Base_modifProjet("URLDEI")) Then MsgBox (Message)
If IsNull(Base_modifProjet("URLDEI")) Then Exit Sub
TextURLDEI.HyperlinkSubAddress = Base_modifProjet("URLDEI")
TextURLDEI.HyperlinkAddress = Base_modifProjet("URLDEI")
End Sub
Hello,
Actually, I can perfectly display the URL in the text box.
But it is a text box and therefore it is editable. Even if the link is displayed underlined in blue, it is not active.
Maybe we need to use a Label instead. But then we will have to modify the Name, the hyperlink, and the hyperlink address.
What I am missing is their VBA correspondence to automate this.
Thank you anyway.
Actually, I can perfectly display the URL in the text box.
But it is a text box and therefore it is editable. Even if the link is displayed underlined in blue, it is not active.
Maybe we need to use a Label instead. But then we will have to modify the Name, the hyperlink, and the hyperlink address.
What I am missing is their VBA correspondence to automate this.
Thank you anyway.