[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

How to import XML data into MsAccess 2007 Table (without .xsd schema file)

Posted on 2010-01-04
2
Medium Priority
?
1,562 Views
Last Modified: 2013-11-27
Hi Experts,

I have a bunch of xml files that I need to analyze in MsAccess.  I try to import through the MsAccess 2007 Wizard but get the following error:

"Cannot find the specified schema file 'XML-ORDERS.xsd.' Remove or update the file reference, and try again to import."

The header of the aforementioned file has a reference as follows:

"XML-ORDERS xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="XML-ORDERS.xsd"

What should I do to parse this file and read the bits of information that i need into an Access Table? Do you have any VBA Code to do this?

Thanks in advance!!!
0
Comment
Question by:MasterandCommander
  • 2
2 Comments
 

Author Comment

by:MasterandCommander
ID: 26172565
I found this site that does exactly what I need in Excel....
http://www.ozgrid.com/forum/showthread.php?t=27818

But this piece of code gives the following error (clicking on debug it highlights "Dim rst As ADODB.Recordset") and says:
"Compile Error: User-defined type not defined"

Sub Read_XML_Data_1()
    Dim rst As ADODB.Recordset
    Dim stCon As String, stFile As String
    Dim i As Long, j As Long
     
    Set rst = New ADODB.Recordset
     
    stFile = "C:\Report.xml"
    stCon = "Provider=MSPersist;"
     
    With rst
        .CursorLocation = adUseClient
        .Open stFile, stCon, adOpenStatic, adLockReadOnly, adCmdFile
        Set .ActiveConnection = Nothing
    End With
     
    With ActiveSheet
         'Add the fieldnames to the first row.
        For j = 0 To i - 1
            .Cells(1, j + 1).Value = rst.Fields(j).Name
        Next j
         'Copy the data from the recordset.
        .Range("A2").CopyFromRecordset rst
    End With
     'Closing the recordset.
    rst.Close
     
     'Release object from memory.
    Set rst = Nothing
     
End Sub
0
 

Accepted Solution

by:
MasterandCommander earned 0 total points
ID: 26172695
Ok.  This does what I want..... I just need to adapt it to my files/database.....
How?
http://www.databasejournal.com/features/msaccess/article.php/10895_3310901_2/Import-XML-Data-Into-Microsoft-Access.htm

0

Featured Post

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

We live in a world of interfaces like the one in the title picture. VBA also allows to use interfaces which offers a lot of possibilities. This article describes how to use interfaces in VBA and how to work around their bugs.
Creating a Cordova application which allow user to save to/load from his Dropbox account the application database.
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

873 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question