Re: multiple xml imports from local path
- From: John Nurick <j.mapSoN.nurick@xxxxxxxxxxxxxx>
- Date: Mon, 05 Sep 2005 19:58:58 +0100
Hi Martijn,
Another MVP, Joe Fallon, posted this code a while ago to show how to use
Dir() to loop through all the files in a folder. You'll need to replace
DoCmd.TransferText with Application.ImportXML and make a few other
changes.
How to Import all Files in a Folder:
Private Sub btnImportAllFiles_Click()
'procedure to import all files in a directory and delete them.
'assumes they are all the correct format for an ASCII delimited import.
Dim strfile As String
ChDir ("c:\MyFiles")
strfile = Dir("FileName*.*")
Do While Len(strfile) > 0
DoCmd.TransferText acImportDelim, "ImportSpecName", "AccessTableName",
"c:\MyFiles\" & strfile, True
'delete the file (consider moving it to an Archive folder instead.)
Kill "c:\MyFiles\" & strfile
strfile = Dir
Loop
End Sub
On Mon, 5 Sep 2005 04:51:09 -0700, "Martijn"
<Martijn@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
>I'm struggling with the import of xml files in access.
>
>I receive the files in outlook and save them as client(1).xml, client(2).xml
>etc in a local folder.
>When I'm using the xml import function in code I only can import a file I
>named in the code.
>
>example:
>Application.ImportXML DataSource:="D:\Clienten XML\client.xml",
>ImportOptions:=acAppendData
>(I can put in the same rule with client(2).xml etc, but there are a lot of
>files this way).
>
>This works fine but how can I tell the import engine that I want to import
>all the *.xml files from "this location" etc.
>
>I think I have to use a loop but I don't know how to define the code.
>
>Can somebody help me?
>
>Thanks
--
John Nurick [Microsoft Access MVP]
Please respond in the newgroup and not by email.
.
- Follow-Ups:
- Re: multiple xml imports from local path
- From: Martijn
- Re: multiple xml imports from local path
- References:
- multiple xml imports from local path
- From: Martijn
- multiple xml imports from local path
- Prev by Date: Re: Data Missing when Exporting from Access to Excel
- Next by Date: Re: Inserting Photos in Access 2000
- Previous by thread: multiple xml imports from local path
- Next by thread: Re: multiple xml imports from local path
- Index(es):
Relevant Pages
|
Loading