473,569 Members | 2,688 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to convert xml to an access database

Hi

I am fairly new to VBA and want to know how I can convert or I mean
parse the XML file and convert to an access database.

Please help. I greatly appreciate your time and help.
I would be glad to have ur answers ASAP.

Thanks a lot

Nov 13 '05 #1
1 6150
Add a reference to Microsoft XML v 3.0 (MSXML3.DLL) to your project.
This will give you access to the XML Document object model (DOM). Load
the XML Document and loop through the nodes in it. Write a record for
each node as appropriate. A sample (unchecked and without error
trapping) is below.

Bill E.
Hollywood, FL

'--------xml document-------------
<?xml version="1.0" encoding="utf-8"?>
<newsgroup name="rec.kites " lastnr="146104" >
<article>
<nr>142980</nr>

<aid>&lt;rN**** *************** ****@news-text.cableinet. net&gt;</aid>
<references></references>
<from>"Bandul u" &lt;ba*****@REM OVETHISdarkdigi tal.org&gt;</from>
<date>4/19/2003 10:45:43 AM</date>
<subject>Re: Line Laundry in UK</subject>
</article>
<article>
<nr>142977</nr>
<aid>&lt;b7**** ********@ID-17525.news.dfnc is.de&gt;</aid>

<references>&lt ;MP************ ************@ne ws.cis.dfn.de&g t;</references>
<from>"David Brown :o\)" &lt;ne**@parkco urt.co.uk&gt;</from>
<date>4/18/2003 11:49:29 PM</date>
<subject>Re: At last, a decent pic!</subject>
</article>
</newsgroup>
'----------------------------------
Sub ReadXMLDocument ()
Dim strPath as String
Dim oXMLDocument As New MSXML2.DOMDocum ent
Dim oDocElement As MSXML2.IXMLDOME lement
Dim oNode As IXMLDOMNode

strPath="Enter the path to the Xml Document"

oXMLDocument.Lo ad strPath
Set oDocElement = oXMLDocument.do cumentElement

'Loop through the top level nodes in the XML document
'Add a record for each one
For Each oNode In oDocElement.chi ldNodes
AddArticle oNode.childNode s(0).Text, oNode.childNode s(1).Text,
oNode.childNode s(2).Text, oNode.childNode s(3).Text,
oNode.childNode s(4).Text, oNode.childNode s(5).Text
Next

Set oNode = Nothing
Set oDocElement = Nothing
Set oXMLDocument = Nothing
End Sub

Function AddArticle(strN r As String, strAID As String, strRef As
String, strFrom As String, strDate As String, strSubject As String)
'Add a record to the articles table tblArticles
Dim strSQL As String

strSQL="INSERT INTO tblArticles (Nr, Aid, References, From, Date,
Subject) "
strSQL=strSQL & "VALUES ('" & strNr & "', '" & strAID & "', '" &
strRef & "', '" & strFrom & "', #" & strDate & "#, '" & strSubject &
"')"
DoCmd.SetWarnin gs False
DoCmd.RunSQL (strSQL)
DoCmd.SetWarnin gs True
End Function

Nov 13 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
7682
by: Gary Dale | last post by:
I have a database that was originally set up in Access 97 (because that was what we had in the office). We had a copy of Access 2000 set up on one machine for a brief period to get at another database that required it. Unfortunately someone used that machine and "upgraded" the Access 97 database to Access 2000. Now I'm trying to get it back...
25
4348
by: cory | last post by:
Hi, I have an Access database and am having an ASP.NEt application written for it. It is almost complete. I have a hosting company that I signed up with a month ago but before I did anything I asked them if Access and ASP.NET would work on their servers, they said yes so I bought in. Now they are saying my application wont work on their...
12
2190
by: dixie | last post by:
Can someone familiar with Access 2003 please answer this question? I am asking because I don't have the use of A2003. When Access 2003 finds an Access 2000 database, does it come up with some sort of question/suggestion indicating that you can convert this datbase into the new format? I am trying to trouble shoot a remote site where a big...
3
2401
by: Dori | last post by:
hi, trying to convert access 97 to access 2003 with the access 2003 convertion tool of microsoft, but the only thing that isn't convert is the modules in the vb of access 97. what should i do ? i need it urgently?
3
2687
by: ET | last post by:
I don't know whats the problem, but after I added functions to first verify, then relink linked tables if not found, now I can't convert that database to MDE format. I can split the database, but can't convert part of the database with forms, reports, queries to MDE format. Can somebody advice on this? References, in the order, from the...
3
2865
by: Jon S via DotNetMonster.com | last post by:
Hi all, Is there a way to convert an Access.mdb from one format (say Access '97 or Access 2000) to Access 2002 format using ADO.NET and C#??? I know how to do it manually using the Access DBMS but I would like to know how to do it programatically. I don't have any idea if this can be done so if it can please could someone show the code...
3
12926
by: Bill Nicholson | last post by:
What tools are available to convert Access projects (Forms, Code, Queries, Reports) to VB Dot Net? Does anyone have experience with this type of conversion? Please tell me I don't have to do it by hand! Thanks, Bill
2
1272
by: Mamatha | last post by:
Hi I want to convert SQLServer database into MS-Access through ASP program.Is there any possiblity to covert?If possible please let me know and thanks in advance. Mamatha
5
2564
by: melickas | last post by:
We designed a custom application using Office Developer Tools '97 which included a Run-time version of Access--- so it would not matter if our customer even had any version of Access on their computer. The application ran without problems on our customer's computer for 2-3 years. Then our customer bought a new computer and we had to reinstall...
6
2215
by: tombsy | last post by:
Hello Group. I work for a company who is about to embark on a long awaited Office upgrade from Office 97 to Office XP. Office XP comes with Access 2002. I am an accomplished Access developer so I have read up on the complexities of upgrade in the corporate environment. Also the need to carry out a full MDB audit to get rid of the...
0
7703
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7618
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8138
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
7983
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
5223
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3657
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3647
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1228
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
946
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.