Mar 11 2022
Greetings VBA Access gurus,
I am trying to find the correct code to firstly list the existing target addresses for a recordset of hyperlinks, and then to update the address to a new SharePoint address...
This was my first and unsuccessful attempt:
Private Sub cmdHyperlinkList_Click()
Dim myDB As DAO.DatabaseDim rst As DAO.RecordsetDim strTable As StringDim intRecords As Integer, i As Integer
strTable = "HyperlinkTest"Set myDB = CurrentDb()Set rst = myDB.OpenRecordset(strTable, dbOpenTable)rst.Index = "PrimaryKey"rst.MoveLastrst.MoveFirstintRecords = rst.RecordCountFor i = 1 To intRecordsrst.Editrst("HyperlinkAddress") = rst("NetworkFolderLocation").Hyperlink.Addressrst.Updaterst.MoveNextNext iSet rst = NothingSet myDB = NothingDoCmd.OpenTable strTable, acViewNormal, acReadOnly
The line in blue is causing the problem
Any help from anyone would be much appreciated.
Mar 12 2022
@Rodster, the core problem here is that a Field has no Hyperlink property.
You can use the built-in Application.HyperlinkPart method to extract individual parts of the value of a Hyperlink column. I also published more sophisticated functions to extract hyperlink parts.
In general, I rather advise against using the Hyperlink data type because it has some issues without bringing much benefit. Using a simple text column is often a better approach.