Linking multiple txt files to Access Table

B

Bboopcom

Can someone please help!! I have multiple (~60) .txt
files that are updated on a daily basis that I would like
to have linked to an Access table.

The issue is, the .txt files are numerous and new files
could be created at any time. I would like to have
these .txt files automatically be imported into its own
Access table (using the name of the file as the table
name). I'm not familiar with MS Access 2000 scripting.
Can someone tell me if this is doable? Also, if you have
a module or ideas of how I might accomplish this I would
really appreciate that too!

Last, is there any good Access scripting books that I
might learn from? Does access use VB scripting or is it
SQL?

Thanks again for your help!
Betty
 
J

Joe Fallon

Access uses VBA (Visual Basic for Applications.)
It can essentiallly do anything VB can.
It is easier than VB for database work!

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
 
B

bboopcom

Great!

Thanks for your help!
Betty
-----Original Message-----
Access uses VBA (Visual Basic for Applications.)
It can essentiallly do anything VB can.
It is easier than VB for database work!

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",
 

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