I have a database that is in three sites, I want to transfer information to and from sites via an FTP site, but how do I import ANY and ALL files that fulfil the naming criteria i.e. JER?????.csv
This is close to something we did. You will have to change directories accordingly, but it shouldn't take much to make it work.
==========
Public Sub ImportData()
On Error GoTo Err_Import
Dim strImportDir As String, strFile As String, strOldFile As String, strNewFile As String
strImportDir = "C:\Apps\Discovery\pmcp\"
Do While strFile <> "" ' Start the loop.
strNewFile = strFile & ".DUN"
strOldFile = strFile
DoCmd.TransferText acImportFixed, "Discovery Import Specs", "tblTempDataDump", strOldFile
FileCopy strOldFile, strNewFile 'Copy file to new name
Kill strOldFile ' Delete Original txt File in "PMCP" Directory
DoEvents
strFile = Dir ' Get next entry.
Loop
Exit_Import:
On Error Resume Next
Application.SetOption "Confirm Action Queries", True
Exit Sub
Err_Import:
MsgBox Err & Err.Description, , "Error in Import"
Resume Exit_Import
End Sub
========== Jim Lunde
compugeeks@hotmail.com
We all agree that your theory is crazy, but is it crazy enough?
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.