Results 1 to 4 of 4
  1. #1
    Zdz16 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Feb 2014
    Posts
    16

    Error link between table and text file

    Hi Expert;



    I have a small problem with the following command:

    Code:
     
    sTabNam = "TmpTab"
    sFilNam = "C:\Data.Txt"
     
    DoCmd.TransferText TransferType:=acLinkDelim, TableName:=sTmpTab, FileName:=sFilNam, HasFieldNames:=True
    The file C:\Data.Txt contains 5 columns, separated by a semicolon with the first line containing the names of the columns. The concern is that when the linked table is created, I get a single column with all fields concatenated value. the following style :

    Col1;Col2;Col3; : Column name
    Val1;Val2;Val3; : Row value

    What does do to have columns separated with the corresponding values?

    Thanks in advance, best regard

  2. #2
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    I suggest you use the wizard to import a sample copy of your text file. You can create, name, and save an import procedure that you can then reference in your VBA. After the import procedure is saved, you can delete the sample data from your table and rely on VBA for the production data.

  3. #3
    Zdz16 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Feb 2014
    Posts
    16
    Thinks for your Replay;

    I solved the problem by using the method you suggest. And by replacing the command as follows:
    Code:
    DoCmd.TransferText acLinkDelim, "Import_Procedure", sTmpTab, sFilNam, True
    Where Import_procedure is the name of save import procedure.

    Best regard

  4. #4
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    Looks good, post if you have any other questions.

    Also, you can import that saved procedure to other DB's by using the "Advanced Options" while importing objects from one DB to another.

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

Similar Threads

  1. Link to text file creates #Num! error on import
    By GregTheSquarePeg in forum Import/Export Data
    Replies: 8
    Last Post: 10-11-2013, 04:32 AM
  2. Replies: 2
    Last Post: 12-27-2012, 09:37 AM
  3. Text File Link
    By pkell658 in forum Import/Export Data
    Replies: 1
    Last Post: 03-23-2010, 04:46 PM
  4. Replies: 3
    Last Post: 01-15-2010, 02:28 PM
  5. Link table using MAC PC file sharing problem
    By TaiYipStreet in forum Access
    Replies: 0
    Last Post: 07-19-2006, 08:02 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