upload text file into access table

dora

New member
Local time
Yesterday, 18:27
Joined
May 24, 2007
Messages
4
hello

i have one text file and i want to have one button and upload text file into access table
i thing that want a vba code

can you help me????
 
Look into using DoCmd.TransferText (the help file has the syntax for it). You can use it either in a macro or in VBA code. To get to the help file in VBA, go into the VBA IDE (integrated development environment) and you can then hit F1 to bring up help and then put in TransferText in the search.
 
Look into using DoCmd.TransferText (the help file has the syntax for it). You can use it either in a macro or in VBA code. To get to the help file in VBA, go into the VBA IDE (integrated development environment) and you can then hit F1 to bring up help and then put in TransferText in the search.


i don't understand
 
As Simon Cowell says, "I'm not trying to be rude, but..." I have a couple of questions for you:

1. Do you know how to access the code window?

2. Do you know how to use Windows Help files?

3. Do you know which key is F1?

If the answer to #1 is no, then open a form in design view and click VIEW > CODE

If the answer to #2 and/or #3 is no, then I really don't know what to tell you other than you need some Windows Basics before continuing.

So did you open the code window and hit your F1 key and then put TransferText into the search?
 
or try file/get external data/import and follow the prompts
 
this is my examlpe and code
but it ish't work good
 

Attachments

you can link or import the data from the txt file into the database.

1 - Do right click on objects tables and select import or link.
2 - Select file type txt and look to your text file.
3 - select your text file and follow the wizard.

Hope this helps
 
i won't a button

if press button then

1. delete all rows from the table
2. open .txt file and
3. insert to table

my code in .zip it doesh't work
if someone to help me

sorry for my bad english
 
You may need to define an import specification...

I think the use of "|" as a delimiter is what is giving you problems. You may circumvent the problem by defining, saving and using an import specification.

To do this, first import the data manually.
> [File], [Get external data], [Import]
> Select your data.txt file
> Specify [delimited], and select [Advanced] at the bottom of the dialog box
> Again, specify [delimited], and define "|" as your [Field Delimiter]
> [Save as], and define a name for your specification. I used "DataImportSpec"
> Complete the rest of the wizard

The code is now:
DoCmd.TransferText acImportDelim, "DataImportSpec", "Data", "C:full Path\data.TXT", 0

Let me know if it worked?
 

Users who are viewing this thread

Back
Top Bottom