Damn it! I almost have it!
I can't figure out how to do this part: (between the two lines)
Code:
'Creates a list of all XML Files in a table (XML_Files) located in the specified directory:
Call runListXMLFiles
'Refresh:
Dim f As Form
For Each f In Access.Forms
f.Requery
Next
Dim DB As DAO.Database
Set DB = CurrentDb
Dim RSTValues As DAO.Recordset
Set RSTValues = DB.OpenRecordset("Collation", dbOpenDynaset, dbSeeChanges)
Dim XMLValues As DAO.Recordset
Set XMLValues = DB.OpenRecordset("XML_Files", dbOpenDynaset, dbSeeChanges)
Dim oDoc As MSXML2.DOMDocument
Set oDoc = New MSXML2.DOMDocument
Dim Path As String
'Select the Path of the First XML File:
XMLValues.MoveFirst
'This loop extract all the filenames that are into the XML File:
Do
Path = XMLValues!FPath
'Open Document
If oDoc.Load(Path) Then
'Extracting the Filename's Node
Dim dtSearchResults As MSXML2.IXMLDOMNode
Dim Item As MSXML2.IXMLDOMNode
Dim Filename As MSXML2.IXMLDOMNode
Set dtSearchResults = oDoc.documentElement.childNodes(0)
For Each Item In oDoc.selectNodes("/dtSearchResults/Item")
Set Filename = Item.selectSingleNode("Filename")
If Not Filename Is Nothing Then
'From the XML Path, extracting the Related to Keyword:
Dim Rel_To As String
Dim RTStart As String
Dim RTinvEnd As String
Dim RTEnd As String
Dim RTLen As String
RTStart = InStrRev(Path, "\")
RTinvEnd = InStrRev(Path, ".")
RTEnd = Len(Path) - RTinvEnd
RTLen = Len(Path) - RTStart - RTEnd - 1
Rel_To = Mid(Path, RTStart + 1, RTLen)
'---------------------------------------------------------------------------------
'Search for the first matching record
RSTValues.FindFirst ([FPath] = Filename.Text)
'Check the result
If RSTValues.NoMatch Then
MsgBox "Record not found."
Else
'---------------------------------------------------------------------------------
'Adding the Related_to Keyword to the Database:
RSTValues.Edit
RSTValues("Related_To").Value = RSTValues!Related_To + " " + ";" + " " + Rel_To
End If
End If
Next Item
Else
'Error Handling
End If
'Go to Next XML Files:
XMLValues.MoveNext
Loop Until XMLValues.EOF
'Refresh:
For Each f In Access.Forms
f.Requery
Next
Basically, I have a table that is already populated, and one of the column is the files' hyperlink.
Now, what I want to do, is to Go to the record where the Hyperlink match the one I extracted from the XML file. Any ideas?