Question : Import a list of files into MSAccess

I have a list of approximately 22 fixed width text files I need to import into an access database.

The file names themselves follow a naming convention to include the date they were written.  There are two files written each day.  One at 900 hours and one at 2100 hours.  That fact is included in the naming convention:

Example:  revp_daily_extract.txt010109.09.00.arc, and revp_daily_extract.txt010110.09.00.arc

I need to first read in the last 10 days worth of files, and import only specified fields.

Once this is done, I'll need to import any unimported (new) files once a week.

Thanks.
Lee

Answer : Import a list of files into MSAccess

Here's a start. Not sure if you also need to know the code for the importing. If so, I can provide that as well. Sorry to do this in pieces. It's been a crazy day.

Sub findfiles(dStartDate As Date, dEndDate As Date, strFolder As String)
Dim strHours As String, dDate As Date


strHours = ".09.00"

dDate = dStartDate

Do While dDate < dEndDate

    If Dir(strFolder & "revp_daily_extract.txt" & Format(dDate, "mmddyy") & strHours & ".arc") > "" Then
        'import data
    End If


    strHours = IIf(strHours = ".09.00", ".21.00", ".09.00")
   
    dDate = dDate + 1
Loop





End Sub



Let me know if you need more.

E
Random Solutions  
 
programming4us programming4us