Results 1 to 2 of 2
  1. #1
    conway is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Feb 2012
    Posts
    1

    use vbs and TransferText cmd to import csv

    Hello, I have an access database on host server.
    I ftp a new csv file to external folder on host server.
    I need a program that they can put in a scheduler to pull the csv file into the database and replace my products table.
    I have been trying to do it with vbs but cannot get it to work on my local machine. Here is code. Is this concept even possible?
    ' VB Script Document
    Option Explicit
    dim conn
    dim strConnect
    dim Inputtable
    dim Importspecname
    dim Pathtofile
    IMPORTSPECNAME = " "
    Inputtable = "products"
    PATHTOFILE = "c:\Inetpub\wwwroot\newtables\mycsv.csv"
    Set conn = CreateObject("ADODB.Connection")
    ' Connect to the database


    strConnect = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\inetpub\wwwroot\data\mydatabase.mdb"
    conn.Open strConnect
    Function ImportFile()
    DoCmd.TransferText acImportDelim, IMPORTSPECNAME, INPUTTABLE, PATHTOFILE, True, ""
    End Function

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,931
    The TransferText method might be available in a vbScript. Review this thread for alternative http://www.mrexcel.com/forum/showthread.php?t=485483
    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. Docmd.TransferText Spec File Not Found
    By Patrick.Grant01 in forum Programming
    Replies: 7
    Last Post: 05-22-2012, 09:32 AM
  2. TransferText
    By za20001 in forum Import/Export Data
    Replies: 1
    Last Post: 01-03-2012, 11:57 AM
  3. DoCmd.TransferText acExportDelim Troubles
    By svcghost in forum Import/Export Data
    Replies: 1
    Last Post: 12-14-2010, 02:35 PM
  4. TransferText problem
    By rossib in forum Import/Export Data
    Replies: 1
    Last Post: 12-17-2009, 04:57 PM
  5. DoCmd.TransferText only if file is new
    By Coolpapabell in forum Programming
    Replies: 1
    Last Post: 10-14-2009, 01:57 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