Results 1 to 3 of 3
  1. #1
    BLD21 is offline Advanced Beginner
    Windows 2K Access 2007
    Join Date
    Apr 2011
    Posts
    55

    Importing Text Delimited

    2007, I am using a button and when clicked it will run an event procedure to import a text file. The text file looks like this:

    Acct number, Company
    "1", "CCCC"
    "77","ABC"
    etc, etc.

    My VB is :

    Private Sub Command10_Click()



    DoCmd.Hourglass (HourglassON)
    DoCmd.DeleteObject acTable, "CUSTOMER_040711"
    DoCmd.TransferText acImportDelim, , "CUSTOMER_040711", "U:\BruceD\CUSTOMER_040711.txt", False

    CurrentDb.TableDefs("CUSTOMER_040711").Fields("F1" ).Name = "ACCT_NUMBER"

    CurrentDb.TableDefs("CUSTOMER_040711").Fields("F2" ).Name = "COMPANY_NAME"

    DoCmd.RunMacro ("Macro3")
    End Sub

    This all works but after the import in my table the first record is always the field name for each. Is there a way to use a text qualifier of "" somehow so I will avoid having a record in my table with the field names.

    Thanks to all,
    Bruce D.

  2. #2
    ajetrumpet is offline VIP
    Windows Vista Access 2007
    Join Date
    Mar 2010
    Location
    N/A
    Posts
    2,694
    bruce,

    why don't you do the import manually one time, save it with a name, and then simply run:

    Code:
    docmd.runimportexport "name"
    that's all you need to do. that'll stop the first record issue.

  3. #3
    thhui is offline Competent Performer
    Windows XP Access 2002
    Join Date
    Feb 2009
    Posts
    235
    Use the schema.ini to control whether the header text should be imported or not.

    For example, you want to import Journal.txt into the access table

    Schema.ini would be like this:-
    [Journal.txt]
    ColNameHeader=true

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

Similar Threads

  1. Replies: 5
    Last Post: 02-20-2011, 08:22 PM
  2. Replies: 1
    Last Post: 11-05-2010, 04:31 PM
  3. Replies: 1
    Last Post: 07-31-2010, 08:04 AM
  4. Import to text - only text value NOT importing
    By Gerry in forum Import/Export Data
    Replies: 10
    Last Post: 03-26-2010, 06:55 AM
  5. Importing a tab delimited file into access table - please he
    By championss in forum Import/Export Data
    Replies: 0
    Last Post: 10-29-2006, 02:33 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