Results 1 to 4 of 4
  1. #1
    ukgooner is offline Novice
    Windows Vista Access 2007
    Join Date
    Aug 2009
    Posts
    3

    Import with a wild card


    Hi - can anybody tell me how I can import a file into an Access db using a wild card. I need to import on a daily basis, but the source file changes it's name every day, i.e. it adds a date suffix to the name. I have tried using * and % without success.

  2. #2
    dcrake's Avatar
    dcrake is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Aug 2009
    Posts
    435
    As explained on another post earlier, If you translate today's date into the name of the file you do not need to use wild cards.

    Lets say the file is called "C:\Test\Fred090909.xls"

    We now by using the Date() function we can derive the date

    Today = Format(Date(),"ddmmyy")

    So the file we need to import is

    sFile = "C:\Test\Fred" & Today & ".xls"

    We can then use sFile as a variable

    Code:
    DoCmd.TransferSpreadsheet acImport, 8, "TblTest", sFile ,True, ""
    David

  3. #3
    ukgooner is offline Novice
    Windows Vista Access 2007
    Join Date
    Aug 2009
    Posts
    3
    Thanks David, but not quite as simple as that. An external server processes a (text) file that I need to import and appends a service number as well as the date, e.g. myfile_090909svc345.txt

  4. #4
    dcrake's Avatar
    dcrake is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Aug 2009
    Posts
    435
    The only way then is to see what the logic is for the naming conventions for the service numbers and create a log file that holds the service numbers of the files imported. Then get the next sequential number and concat that into the file name. The only issue here is if the names are not sequential to you. Alternatively you may need to populate a list box with files of that date mask in to a list/combo box and let the user select.

    David

Please reply to this thread with any new information or opinions.

Similar Threads

  1. How would I import something like this?
    By Insyderznf in forum Import/Export Data
    Replies: 13
    Last Post: 08-10-2009, 05:18 PM
  2. Import from various folders
    By Statique in forum Import/Export Data
    Replies: 2
    Last Post: 07-02-2009, 06:10 AM
  3. Import a .sql file?
    By Alan in forum Import/Export Data
    Replies: 1
    Last Post: 06-03-2009, 07:52 PM
  4. Validation on import
    By andy_42 in forum Import/Export Data
    Replies: 1
    Last Post: 10-23-2006, 03:52 PM
  5. IMPORT ERROR ..PLEASE HELP
    By fadone in forum Import/Export Data
    Replies: 2
    Last Post: 04-20-2006, 06:36 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums