Results 1 to 4 of 4
  1. #1
    akshatagarwal93 is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Jul 2012
    Posts
    14

    Changing File Location in saved imports using VBA


    I'm very sorry if this question has been asked elsewhere however I couldn't find it after a quick search...

    My problem is that I am importing data from a text file into a table in my access (2007) database. I know how to run this in my database from the click of a button (DoCmd.RunSavedImportExport ("Import text files")) however I want to actually edit the name of the file being uploaded.

    The user should be able to input the file path then this is used to import the respective text file onto a new table. I am unsure how to proceed and any method I have found so far is very complicated and involves accessing the XML file and changing the name directly. Is there any other way?

    Thanks in advance

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    50,140
    I don't think you can use RunSavedImportExport for dynamic parameters.

    Use a form to input the import specifications then VBA code to concatenate reference to controls on form into the TransferText action statement.

    DoCmd.TransferText acImportDelim, "Standard Output", "tablename", "your file path\" & Me.txtboxname

    http://msdn.microsoft.com/en-us/libr...ffice.12).aspx
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    akshatagarwal93 is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Jul 2012
    Posts
    14
    Thanks June7.

    The problem I have been having with the TransferText method is that I cannot specify the import to be tab-delimited. Rather it seems to import using commas as the delimiters (this is even the case when I remove all commas from the text document). Is there any way to enforce this method of transfer?

    Thanks

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    50,140
    Maybe by using an import specificiation file (schema.ini) created by the Import/Export wizard.

    This is described in the link I referenced.

    I have never done it so let me know what happens when you try.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

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

Similar Threads

  1. Replies: 5
    Last Post: 04-01-2012, 12:50 PM
  2. Access 2010 Saved Imports
    By Tomfernandez1 in forum Access
    Replies: 1
    Last Post: 09-27-2011, 12:27 PM
  3. Attachment file location change
    By gary742 in forum Access
    Replies: 3
    Last Post: 03-22-2011, 12:26 PM
  4. File Location
    By Mitch87 in forum Programming
    Replies: 1
    Last Post: 02-19-2010, 11:12 AM
  5. Tab Delimited Imports
    By SandyDandy in forum Import/Export Data
    Replies: 1
    Last Post: 02-20-2009, 08:53 AM

Tags for this Thread

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 - Senior Forums