I am trying to write a simple MS Access application to read a collection of files in XML format. I've written a few lines of code that should take a document name supplied via a form, open the document, a display some detail of the contents. However, the code always fails at a preliminary step with the asynch method. Taking this out would cause the rest of the code to execute before the document is loaded so it is a mandatory step.
I've checked the libraries referenced and tried to instantiate the document as "microsoft.XMLDOM", "MSXML2.DOMDocument" and "MSXML2.DOMDocument.6.0" but still get the same error.
The code fails at the line "Set xmlDoc.async = False" with run-time error 424.
The libraries referenced are:
Visual Basic for Applications
Microsoft Access 14.0 Object Library
OLE Automation
Microsoft Office 14.0 Access database engine Object Library
Microsoft XML, v6.0
Option Compare Database Option Explicit Private Sub ProcessButton_Click() Dim xmlDoc As Object Dim xmlSourceList As Object Dim xmlSource As Object Set xmlDoc = CreateObject("MSXML2.DOMDocument.6.0") Set xmlDoc.async = False xmlDoc.Load (Me.ReportFilename) Set xmlSourceList = xmlDoc.selectSingleNode("//DataSources") For Each xmlSource In xmlSourceList.childNodes MsgBox xmlSource.Attributes.getNamedItem("Name").Text Next xmlSource End Sub