Importing text file

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Wonder if there is a way so that i can do get text files and then do a
transfer text. I tried the transfertext macro but it only looks for the file
name & directory that is already defined. Want to know if i can somehow make
a popup dialog, so that i can select the file and directory instead of the
predefined. Thanks
 
Justin,

If you have an unbound textbox on a form, where the user can enter the
path and filename of the text file, I think you will then be able to
refer to this in the File Name argument of the TransferText macro by
using syntax such as...
=[Forms]![NameOfForm]![NameOfTextbox]
 
i tried to do the unbound text but to know success. I want to make like a
popup window so the user can search for the file instead of user knowing the
path and file name

Steve Schapel said:
Justin,

If you have an unbound textbox on a form, where the user can enter the
path and filename of the text file, I think you will then be able to
refer to this in the File Name argument of the TransferText macro by
using syntax such as...
=[Forms]![NameOfForm]![NameOfTextbox]

--
Steve Schapel, Microsoft Access MVP

Wonder if there is a way so that i can do get text files and then do a
transfer text. I tried the transfertext macro but it only looks for the file
name & directory that is already defined. Want to know if i can somehow make
a popup dialog, so that i can select the file and directory instead of the
predefined. Thanks
 
ok, i created a form with the unbound text and then created a Transfertext
Macro
Transfer Type: Import Delimited
Speification Name: Trans import spec
Table Name: Tran
File Name: =[Forms]![Browse]![Unbound]
Has Field Names: NO

so i click on the form, selected the file and tried to run the macro. It
gives me this error
"An Expression you entered is the wrong data type for one of the arguments.

Yor tried to run a macro or use a method to carry out an action, but an
expression evaluated to the wrong data type.
For example, for the Close method you specified a string for the Object Type
argument, but this argument can be set only to certain intrinsic constants or
their numeric equivalents"

need help!!!

Steve Schapel said:
Justin,

If you have an unbound textbox on a form, where the user can enter the
path and filename of the text file, I think you will then be able to
refer to this in the File Name argument of the TransferText macro by
using syntax such as...
=[Forms]![NameOfForm]![NameOfTextbox]

--
Steve Schapel, Microsoft Access MVP

Wonder if there is a way so that i can do get text files and then do a
transfer text. I tried the transfertext macro but it only looks for the file
name & directory that is already defined. Want to know if i can somehow make
a popup dialog, so that i can select the file and directory instead of the
predefined. Thanks
 
Justin,

Here are a few ideas that might help track down the problem... Is
"Unbound" the actual name of the textbox on the Browse form? Did you
enter into this textbox the full path/file name of the file? For example,
C:\MyFolder\MyFile.txt
Is it a .txt file that you are trying to import? After you enter the
file into the Unbound textbox, did you move the cursor out of the
textbox, in order to "register" the entry as the tetxbox's value? Are
you sure that you have the Import Specification set up correctly? Is
there data in the text file that doesn't match the data type of the
fileds in the Tran table in your database?
 
Back
Top