I am trying to import an XML document and because of how it's set up I already know that an XSLT will not work. I need to import it using the DOMDocument coding. I am trying to learn the code, but have gotten stuck with the first test. This is an example straight out of the book. Here is my code:
===============================================
Private Sub ImportXML_Click()
Dim objDOMDocument As DOMDocument
Dim objXMLDOMElement As IXMLDOMElement
Me.txtFileName = "C:\Documents and Settings\Jaynelle\My Documents\ScottsTreatmentCtr\SCC_XML\20100305_To_8.xml"
Set objDOMDocument = New DOMDocument
objDOMDocument.async = False
objDOMDocument.Load Chr(34) & Me.txtFileName & Chr(34)
Set objXMLDOMElement = objDOMDocument.DocumentElement
MsgBox "objXMLDOMElement is " & objXMLDOMElement.nodeName <-------ERROR IS HERE------>
End Sub
=======================================================
This is on a form and the txtFileName is usually on the form, but have it in the code just for testing.
When the code breaks I can roll over the objXMLDOMDocument and see that it equals "Nothing". I am able to do a direct import of the XML (imports 6 table with no related fields).
========================================================
Object References: I've added a few more than I usually use just to make sure it wasn't something there:
Visual Basic for Applications
Microsoft Access 11.0 Object Library
Microsoft DAO 3.6 Object Library
OLE Automation
Microsoft ActiveX Data Objects 2.8 Library
Microsoft ADO Ext. 2.8 for DDL and Security
Microsoft Jet and Replication Objects 2.6 Library
Microsoft Office 12.0 Object Library
Microsoft XML, v6.0
Microsoft Data Access Components Installed Version
==========================================================
Thanks!
JPR
===============================================
Private Sub ImportXML_Click()
Dim objDOMDocument As DOMDocument
Dim objXMLDOMElement As IXMLDOMElement
Me.txtFileName = "C:\Documents and Settings\Jaynelle\My Documents\ScottsTreatmentCtr\SCC_XML\20100305_To_8.xml"
Set objDOMDocument = New DOMDocument
objDOMDocument.async = False
objDOMDocument.Load Chr(34) & Me.txtFileName & Chr(34)
Set objXMLDOMElement = objDOMDocument.DocumentElement
MsgBox "objXMLDOMElement is " & objXMLDOMElement.nodeName <-------ERROR IS HERE------>
End Sub
=======================================================
This is on a form and the txtFileName is usually on the form, but have it in the code just for testing.
When the code breaks I can roll over the objXMLDOMDocument and see that it equals "Nothing". I am able to do a direct import of the XML (imports 6 table with no related fields).
========================================================
Object References: I've added a few more than I usually use just to make sure it wasn't something there:
Visual Basic for Applications
Microsoft Access 11.0 Object Library
Microsoft DAO 3.6 Object Library
OLE Automation
Microsoft ActiveX Data Objects 2.8 Library
Microsoft ADO Ext. 2.8 for DDL and Security
Microsoft Jet and Replication Objects 2.6 Library
Microsoft Office 12.0 Object Library
Microsoft XML, v6.0
Microsoft Data Access Components Installed Version
==========================================================
Thanks!
JPR