PC Review
Forums
Newsgroups
Microsoft Access
Microsoft Access VBA Modules
Using Import Specifications for an import through VBA
Forums
Newsgroups
Microsoft Access
Microsoft Access VBA Modules
Using Import Specifications for an import through VBA
![]() |
Using Import Specifications for an import through VBA |
|
|
Thread Tools | Rate Thread |
|
|
#1 |
|
Guest
Posts: n/a
|
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. |
|
|
|
#2 |
|
Guest
Posts: n/a
|
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" <FrankM@discussions.microsoft.com> wrote in message news:11FB3CCA-00B9-4771-9219-37820AEFEB6D@microsoft.com... >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. |
|
|
|
#3 |
|
Guest
Posts: n/a
|
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. |
|
![]() |
| Thread Tools | |
| Rate This Thread | |
|
|

Main Page 

