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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Import Xml Question

Status
Not open for further replies.

RonQA

Technical User
Jun 24, 2007
61
US
When importing an Xml file into Access using VBA, can you direct the data to a specific table?

When I perform the import it is creating a new table based on the Xml file. I would like to be able to direct it to the table I have previously named.

Any help would be greatly appreciated.

Private Sub Command0_Click()
Dim strFile As String 'Filename
Dim strFileList() As String 'File Array
Dim intFile As Integer 'File Number
Dim strPath As String ' Path to file folder

strPath = "C:\New OE Imports\"
strFile = Dir(strPath & "*.XML")

While strFile <> ""
'add files to the list
intFile = intFile + 1
ReDim Preserve strFileList(1 To intFile)
strFileList(intFile) = strFile
strFile = Dir()
Wend

'see if any files were found
If intFile = 0 Then
MsgBox "No files found"
Exit Sub
End If

'cycle through the list of files
For intFile = 1 To UBound(strFileList)
Application.ImportXML strPath & strFileList(intFile), 2
Next intFile

MsgBox "Import Completed
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top