+ Reply to Thread
Results 1 to 3 of 3

file import from a module

  1. #1
    Registered User
    Join Date
    03-20-2009
    Location
    Phila, PA
    MS-Off Ver
    Excel 2003
    Posts
    56

    file import from a module

    I wish to import a comma delimited text file to a table using a VBA module.
    I have succeeded doing so with this:
    DoCmd.TransferText acImportDelim, "cisco Import Specification", "0901C", "0901CDR.txt"

    I want to pass a variable from an input box, said variable being the first 4 characters of the text file and the import table (in this example 0901)
    I get the variable like this:
    TableName = InputBox("Enter a Table Name for Updating", "Input")
    but I am having trouble with syntax passing said variable to the TransferText statement.

  2. #2
    Registered User
    Join Date
    03-20-2008
    Location
    Buffalo, NY USA
    Posts
    43

    Re: file import from a module

    Have you tried this:

    DoCmd.TransferText acImportDelim, "cisco Import Specification", TableName, TableName & "CDR.txt"

    I can't see why that wouldn't work. If it errors out, what is the error message? You will have to declare TableName as a String, by the way, otherwise you could lose the leading zero.

  3. #3
    Registered User
    Join Date
    03-20-2009
    Location
    Phila, PA
    MS-Off Ver
    Excel 2003
    Posts
    56

    Re: file import from a module

    That worked! I kept embedding the variable names in "" and '' and []. That was where it was failing.

    Thank you.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1