PC Review


Reply
Thread Tools Rate Thread

Using Import Specifications for an import through VBA

 
 
=?Utf-8?B?RnJhbmsgTQ==?=
Guest
Posts: n/a
 
      12th Oct 2004
I have a monthly update to make on an Access database (2000 format) that
involves the execution of several imports queries.
I have all the actions to be done in a table in Access. Now I want to
automate the whole job through a program. As far as I can see running the
queries can be done through the DoCmd object, the RunSQL method (or perhaps
better through ADO and ADOX to get the query contents).
However, I can't see how I would perform the imports using the Import
specifications that I have saved in the database.
Besides giving the Import Spec name I would also have to give the name of
the table to be imported too. So my question is:

How can I start an import with a given Import Spec (by name) to a named table?

I have found an Application.DoCmd object with a RunCommand method that I can
use with the parameter acCmdImport. But my guess is that this will just open
the Import dialog window from which I would have to proceed manually. I don't
see anywhere to specificy the import spec name or input table name in the
call of the method.

Hope someone can help.


Best regards,

Frank M.
 
Reply With Quote
 
 
 
 
Allen Browne
Guest
Posts: n/a
 
      12th Oct 2004
Try TransferText, e.g.:

DoCmd.TransferText acImportDelim, "MySpec", "MyTable", "C:\MyFile.txt"

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Frank M" <(E-Mail Removed)> wrote in message
news:11FB3CCA-00B9-4771-9219-(E-Mail Removed)...
>I have a monthly update to make on an Access database (2000 format) that
> involves the execution of several imports queries.
> I have all the actions to be done in a table in Access. Now I want to
> automate the whole job through a program. As far as I can see running the
> queries can be done through the DoCmd object, the RunSQL method (or
> perhaps
> better through ADO and ADOX to get the query contents).
> However, I can't see how I would perform the imports using the Import
> specifications that I have saved in the database.
> Besides giving the Import Spec name I would also have to give the name of
> the table to be imported too. So my question is:
>
> How can I start an import with a given Import Spec (by name) to a named
> table?
>
> I have found an Application.DoCmd object with a RunCommand method that I
> can
> use with the parameter acCmdImport. But my guess is that this will just
> open
> the Import dialog window from which I would have to proceed manually. I
> don't
> see anywhere to specificy the import spec name or input table name in the
> call of the method.
>
> Hope someone can help.
>
>
> Best regards,
>
> Frank M.



 
Reply With Quote
 
=?Utf-8?B?RnJhbmsgTQ==?=
Guest
Posts: n/a
 
      12th Oct 2004
Hrm.. I guess the DoCmd.RunCommand with acCmdImport was not the right way. I
found the DoCmd.TransferText method which will do the job nicely. Here you
can specify Import spec name, input table name, etc.


Frank M.


"Frank M" wrote:

> I have a monthly update to make on an Access database (2000 format) that
> involves the execution of several imports queries.
> I have all the actions to be done in a table in Access. Now I want to
> automate the whole job through a program. As far as I can see running the
> queries can be done through the DoCmd object, the RunSQL method (or perhaps
> better through ADO and ADOX to get the query contents).
> However, I can't see how I would perform the imports using the Import
> specifications that I have saved in the database.
> Besides giving the Import Spec name I would also have to give the name of
> the table to be imported too. So my question is:
>
> How can I start an import with a given Import Spec (by name) to a named table?
>
> I have found an Application.DoCmd object with a RunCommand method that I can
> use with the parameter acCmdImport. But my guess is that this will just open
> the Import dialog window from which I would have to proceed manually. I don't
> see anywhere to specificy the import spec name or input table name in the
> call of the method.
>
> Hope someone can help.
>
>
> Best regards,
>
> Frank M.

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Import Specifications TotallyConfused Microsoft Access External Data 2 20th Jun 2009 08:34 PM
Import Specifications =?Utf-8?B?Y2tyb2dlcnM=?= Microsoft Access VBA Modules 3 18th Mar 2007 10:10 AM
Import Specifications =?Utf-8?B?RG9u?= Microsoft Access External Data 1 3rd Sep 2005 07:12 AM
Help using Import Specifications under Import/Advanced Ari B via AccessMonster.com Microsoft Access External Data 0 24th Jan 2005 10:34 AM
How to use import specifications in ADP? Kola Microsoft Access ADP SQL Server 0 11th Dec 2003 04:43 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:41 AM.