Import .xml with a macro

1

1whtevr

I recently upgraded to 2007.
In Access 2003 I would set up a macro to run a query to delete a table, then
using an import spec and transfer text action, import new data from a .txt
file and recreate the table.
Now in 2007 I can import an .xml and save the import and use it, but in the
macro design I no longer have an option to transfer data and fill in the
import spec and path to the file.
Is there a different command in 'Action' I can use? I want the macro to be
part of a multi step process where the table 'intrument' is deleted, then the
..xml is imported (I haven't set up an .xml import spec as part of a macro
before) into the recreated 'intrument' table. I have several queries and
steps before and after this process, so don't want to just run the saved
import. I don't generally write in vba, but use macros to run multi step
processes, then put a botton on the switchboard to run the macro. I
appreciate any insight/help. Thanks
 
J

John Spencer

Perhaps I don't understand, but I thought xml has the specifications built
into the xml file. So you can either import into an existing table (tables)
or add a new table (or new tables) based on the structure defined in the XML file.

John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County
 
1

1whtevr

I apologize in advance if I'm not doing a good job explaining. I am a
regular user of Access, but I don't have the depth of knowledge most here
appear to.

Thank you for your response.

The specs to create the table are in the .xml.
I imported the .xml and created a 'saved import' named Daily data (for
example).
I am looking for a way of defining/designing a macro with a step to go to a
given directory and import the .xml. I don't want to use the 'saved imports'
on the external data tab to import it, but want to be able to put the 'saved
imports' (Daily data) into a macro that will not stop, and will run the 10
steps besides the import. I just don't see a way to put the 'saved import'
step into the macro. I don't have to use the saved import if the I can set
up some sort of transfer xml in the macro and define the directory and file.
The specs in the .xml do correctly create the table, I just want it to be an
automated step of a macro.

Thanks.
 
J

John Spencer

There is a macro action RunSavedImportExport, but it only shows up in the list
of actions if you have clicked the ShowAllActions button in the Show/Hide
section of the Ribbon. Have you tried that.

If you are using VBA and not a macro then you would use the ImportXML command
and specify the path to the xml file as the argument

ImportXML "C:\MyFolder\MyXMLDateFile.xml"

John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County
 
1

1whtevr

I did not have the show all actions selected. That is exactly the
information I needed. Thank you very much.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Excel Import XML into Excel 0
Running a Macro 5
Print Import Spec 1
XML Import problem 3
Macro for Import of data 1
Import Spec CSV 7
Change data type with a Macro 5
Create an import template without a primary key. 5

Top