Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help with ImortXML Method, or point me to good source?

Status
Not open for further replies.

H3rk

Technical User
Jun 2, 2006
17
US
Ive been trying to set up code to automatically import an XML document but the simple examples just aren't working.

I've used the examples in

and

but the format isnt working at all.

I use

Code:
Public Sub NutLog()
  Dim sXMLPath As String
  Const cOverWrite As Integer = 1
  sXMLPath = "C:\Documents and Settings\Me\My Documents\ImportFile.xml"
  
    ImportXML sXMLPath, acStructureAndData, cOverWrite

End Sub
and I'm unsure where I would plug in
Code:
Application.ImportXML _
    DataSource:="C:\Documents and Settings\Me\My Documents\ImportFile.xml", _
    ImportOptions:=acStructureAndData

I would like to overwrite the previous import each time it executes. I would like it to trigger when the project opens. But I'm not sure how.
 
I jumped the gun....OfficeSpace has the right answer..
Code:
Sub ImportNutrition()

Set objAccess = CreateObject("Access.Application")
objAccess.OpenCurrentDatabase "C:\Documents and Settings\Me\My Documents\MyFile.mdb"

objAccess.ImportXML "C:\Documents and Settings\Me\My Documents\MyFile.xml", acAppendData


End Sub

well maybe it will answer some other novices question.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top