Results 1 to 4 of 4
  1. #1
    Join Date
    Sep 2004
    Posts
    28

    Arrow Unanswered: Automated Query UPLOAD

    HI guys i have this flder where all my files are placed of my text....which i upload it manually to transafer them in ACCESS to make table of them.
    - i want to just place those files in folder and they get uploaded automatically! is there anyway possible! file names are based on based on dates example : SL_090804, SL_090904, SL_102404....
    -can some one help me on that i ampostingmy form coding here...below:
    Option Compare Database

    Private Sub Command1_Click()
    DoCmd.TransferText acImportFixed, "SL070D-R05 Import Specification", _
    "temp_Stockloan", Text2

    DoCmd.SetWarnings False
    DoCmd.OpenQuery "StockLoan Append Query"
    DoCmd.SetWarnings True

    DoCmd.SetWarnings False
    DoCmd.OpenQuery "SLTradesandTransactions"
    DoCmd.SetWarnings True

    DoCmd.SetWarnings False
    DoCmd.OpenQuery "EXCEL READY APPEND"
    DoCmd.SetWarnings True

    DoCmd.SetWarnings False
    DoCmd.OpenQuery "Delete"
    DoCmd.SetWarnings True

    DoCmd.SetWarnings False
    DoCmd.OpenQuery "Delete1"
    DoCmd.SetWarnings True

    DoCmd.DeleteObject acTable, "temp_Stockloan"
    End Sub

  2. #2
    Join Date
    Dec 2002
    Location
    Préverenges, Switzerland
    Posts
    3,740
    here are a couple of examples of gathering data from *.XLS files in a directory - not exactly what you are looking for, but you didn't get any other replies so far.

    izy
    currently using SS 2008R2

  3. #3
    Join Date
    Feb 2004
    Location
    Chicago, IL
    Posts
    1,312
    As long as you are using the same file specification for each file, it looks like all you need to do is to loop through the file names and then maybe move the files to another folder.

    To loop through the files use the Dir() function. You can probably find some help on it but you would use it something like:

    Code:
    dim strFilename as string
    
    strFilename = Dir("C:\The Rest of your path\*.txt")
    
    While strFilename<>"" 
    
    'Add you code here
    
    Name strFilename as "C:\Archive Folder Name\" & strFilename
    strFilename=Dir()  'Get the next file
    
    Wend
    Then after each file is imported and processed, move them to another folder (processed folder) using the Name function.

  4. #4
    Join Date
    Sep 2004
    Posts
    28
    thankx guys it was helpful!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •