Xml

Nero

Shop smart, shop S-Mart
Local time
Today, 19:53
Joined
Jan 8, 2002
Messages
217
Has anyone ever used Access to import XML data.
My boss has been told that it is possible but I've never used it.
I have searched the forum but there are not many threads on XML.
Can anyone offer any advice??
 
Access XP has an XML import filter you can use, not sure about 2K. Earlier version I beleive you have to use a XML parser to create a file Access can read (convert it to something else).
 
Never done it myself but you could mess about with the following code

IMO



Function importXML()
Dim rstXML as New ADODB.recordset
Dim rstYourTable as New ADODB.recordset
Dim myTable as string

myTable = "YourTable" ' Your Table Name

'open the recordsets:
rstXML.open "c:\YourFolder\Yourfile", "Provider=MSPersist",,, adCmdFile

rstYourTable.open myTable, currentproject.connection, adOpenDynamic, adLockOptimistic

'Add the xml data to YourTableName
with rstXML
Do while .EOF = false and .BOF = false
rstYourTable.addnew
rstYourTable!Field1 = rstXML!Field1 'change this to your fieldname
'etc. etc.

rstYourTable.update
rstXML.movenext
end with

'close recordsets again
rstXML = nothing
set rstXML = nothing
rstYourTable.close
set rstYourTable = nothing
End function
 
Thanks for the replies,
from what I've read, XP seems the way to go.
IMO, I will give your code a go.

Thanks again.
 

Users who are viewing this thread

Back
Top Bottom