command line import?

L

Lewis Paskin

Hi,

I am running Access 2002. I have the following in a file
named Module1.bas:

Attribute VB_Name = "Module1"

Sub patimport()
DoCmd.TransferText
acImportDelim, "rarspec", "patient", "c:\raritan\a333.txt"
End Sub

When I execute this from inside Access, it works great. I
would like to use this same functionality from a DOS
prompt or a script (ie. outside of Access). How can I do
this?

Thanks for any help you can provide.

Lewis.
 
G

Glen Appleton

The easiest way to automate running of processing is to create a macro
called "Autoexec", and call the routine from the macro using the RunCode
action. You will need to change the routine from a sub to a function in
order for the RunCode action to see it. Then, whenever the mdb file is
opened, the macro will auto execute. If you need to open the mdb file to
edit anything, just hold the shift key when opening and the macro will not
execute.

I have found that it's better to create a separate mdb file for processing
of this nature and link to the tables in the main database. You might also
want to add the Application.Quit method to the end of the routine to close
the mdb file when processing has completed. I use this method for process
scheduling and just call the mdb file in the scheduling parameters.

Hope this helps,
- Glen
 

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

Top