Results 1 to 3 of 3
  1. #1
    Join Date
    Aug 2009

    Unanswered: Passing FileName to Import File

    I am importing a text file and have the user provide the input text file. It is stored in text1. The value of Text1 is "C:\test.TXT" . I cannot get that to work in my select statement.
    "SELECT * INTO NewContact FROM [Text;Fmt=Delimited(|);HDR=No;DATABASE=text1.value" , _

    The following works:
    Dim strsql As String
    strsql = "SELECT * INTO NewVendor FROM [Text;Fmt=Delimited(|);HDR=No;DATABASE=C:\;].[test.txt];" _
    Dim db As DAO.Database
    Set db = CurrentDb()
    db.Execute _
    strsql, _

    How can I manipulate the text1.value to get it to work the select statement?

  2. #2
    Join Date
    Mar 2009
    Provided Answers: 15
    You need to specify to whick object Text1 pertains:
    SELECT... ;DATABASE=Forms!MyForm!text1.value
    Have a nice day!

  3. #3
    Join Date
    Aug 2009
    Thanks, but I am getting a value -- "C:\test.TXT" in the text box, the statement will not use it that way. It works when it is in this format -- DATABASE=C:\;].[test.txt]
    Last edited by sa2; 08-13-09 at 09:37.

Posting Permissions

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