Results 1 to 2 of 2
  1. #1
    falconfox is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Dec 2012
    Posts
    1

    Importing CSV file using VBA

    Hi everyone. I'm a new Access user. I've outgrown my Excel database and am converting to Access.



    I need help linking a CSV file using VBA code. I've been successful linking the CSV file using the "External Data" > "Import & Link" > "Text File" wizard. I've also been successful in making a button Macro import the CSV file. I was hoping to use the "Convert Macros to Visual Basic" function to see what the underlying VB code is, but for some reason the button is grey and cannot be clicked.

    My Macro uses the "ImportExportText" Action. What is the equivalent VBA code for this action? I cannot figure it out.

    I've search Google and tried using

    Code:
    DoCmd.TransferText acImportDelim, "", "Table1", "C:\Winxp\testing.csv", True, ""  ' where table1 is your table
    
    but that didn't work.

    Someone please help.

    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
    52,822
    Why didn't it work - error message, wrong results, nothing happens? I don't see anything wrong with the code.

    Don't know why the conversion tool would not be available. If you want to provide files for analysis, follow instructions at bottom of my post.
    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. Importing A Text File
    By steve2507 in forum Access
    Replies: 5
    Last Post: 02-28-2012, 01:48 AM
  2. Importing data from a .txt file
    By The Dad in forum Access
    Replies: 2
    Last Post: 08-25-2011, 01:45 PM
  3. Importing Txt file to Access
    By fuxy in forum Access
    Replies: 6
    Last Post: 04-25-2011, 07:58 AM
  4. Importing Txt file via Vb
    By jquickuk in forum Import/Export Data
    Replies: 1
    Last Post: 04-01-2009, 08:27 AM
  5. Importing file into Access
    By jquickuk in forum Import/Export Data
    Replies: 1
    Last Post: 03-23-2009, 09:18 PM

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