Importing files???

bgcogen

Registered User.
Local time
Today, 15:12
Joined
Apr 19, 2002
Messages
61
Hi!!
Not strictly Access, but maybe someone can help.

Basically I want some VB code to import the contents of a folder. The folder will contain about 30 files. Is there anyway to just say - import all of the files in this folder one after another - without acyually knowing their name>>>>

Importfile = " .... .... .... ...."


Thanbks if anyone has any ideas :)

D
 
Importing

Access only allows for the importing of one file at a time. This does not mean that a routine could not be created to do it x number of times.

A lot kinda depends on the types of files being imported and whether they are all the same types of files and have the same specifications.

A little more detail would help
 
re: importing

this code is from the site http://support.microsoft.com/default.aspx?scid=kb;en-us;Q198467

hopefully it helps:


Private Sub Command0_Click()
Dim InputDir, ImportFile As String, tblName As String
Dim InputMsg as String

InputMsg = "Type the pathname of the folder that contains "
InputMsg = InputMsg & "the files you want to import."
InputDir = InputBox(InputMsg)
' Change the file extension on the next line for the
' type of file you want to import.
ImportFile = Dir(InputDir & "\*.dbf")

Do While Len(ImportFile) > 0
' Use the import file name without its extension as the table
' name.
tblName = Left(ImportFile, (InStr(1, ImportFile, ".") - 1))
' Change dBase III on the next line to the type of file you
' want to import.
DoCmd.TransferDatabase acImport, "dBase III", InputDir, _
acTable, ImportFile, tblName
ImportFile = Dir
Loop
End Sub
 

Users who are viewing this thread

Back
Top Bottom