[AccessD] Loadfromtext

Mark A Matte markamatte at hotmail.com
Mon Sep 25 11:44:02 CDT 2006


Martin,

I'm not sure that I understand exactly what you are asking...but I have a 
stock program that does something similar.  Every 30 minutes...this app 
checks an FTP site...gets all file(*.zip), unzips ALL files, then imports 
ALL files.  All of my files have different names, but they are all in the 
same format...your email almost sounds like you would have to import 
differently for each file name???

If not...below is the code I use to import ALL files in a named 
folder...regardless of  file name, just looking for the extensions.

Hope it helps,

Mark A. Matte

SAMPLE
*******************************
Public Function ImportData()
MyPath = "C:\Stock\BriterStockBiHourlyTEMP\*.csv"
MyName = Dir(MyPath)   ' Retrieve the first entry.
DoCmd.SetWarnings False

Do While MyName <> ""   ' Start the loop.
DoCmd.TransferText acImportDelim, "EndofdayallImportSpecification", 
"tblDailyStock", "C:\Stock\BriterStockBiHourlyTEMP\" & MyName



    ' Ignore the current directory and the encompassing directory.
    If MyName <> "." And MyName <> ".." Then
    MyName = Dir    ' Get next entry.
    End If
Loop

FileCleanUp

End Function

*************************

>From: "Martin Reid" <mwp.reid at qub.ac.uk>
>Reply-To: Access Developers discussion and problem 
>solving<accessd at databaseadvisors.com>
>To: "Access Developers discussion and problem 
>solving"<accessd at databaseadvisors.com>
>Subject: [AccessD] Loadfromtext
>Date: Mon, 25 Sep 2006 16:27:39 +0100
>
>I want to loop over a folder contain X number of text files. Any ideas. For 
>example
>
>Application.LoadFromText acForm, "test", "C:\forms\Form_Customer List.txt"
>
>Instead of a single file I need them all BUT some are prefixed FORM, 
>REPORT,MODULE, QUERY and I need to change the constant accordingly.
>
>I know I can run one process for each type but would it be possible to do 
>them all in the proper squence in one hit.
>
>Martin
>
>Martin WP Reid
>Training and Assessment Unit
>Riddle Hall
>Belfast
>
>tel: 02890 974477
>
>


>--
>AccessD mailing list
>AccessD at databaseadvisors.com
>http://databaseadvisors.com/mailman/listinfo/accessd
>Website: http://www.databaseadvisors.com





More information about the AccessD mailing list