PC Review


Reply
Thread Tools Rate Thread

Command and syntax to import .txt files to Ms Access table?

 
 
=?Utf-8?B?VGVyZW5jZQ==?=
Guest
Posts: n/a
 
      21st Jun 2005
I have a Microsoft Access Database and have the structure defined.
Currently, I manually select the Import function of Microsoft Access to
import 9 .txt files into one of the table in that Access database (before I
import the 9 .txt files, I need to manually delete all the records of that
table).

Could anyone tell the Microsoft Access command and syntax to
1. delete all records of that table AND
2. import the 9 .txt files into that table .

Thanks.

 
Reply With Quote
 
 
 
 
Dirk Goldgar
Guest
Posts: n/a
 
      21st Jun 2005
"Terence" <(E-Mail Removed)> wrote in message
news:75EFC93C-1D80-4593-AD43-(E-Mail Removed)
> I have a Microsoft Access Database and have the structure defined.
> Currently, I manually select the Import function of Microsoft Access
> to import 9 .txt files into one of the table in that Access database
> (before I import the 9 .txt files, I need to manually delete all the
> records of that table).
>
> Could anyone tell the Microsoft Access command and syntax to
> 1. delete all records of that table AND
> 2. import the 9 .txt files into that table .


To delete all records from a table named "Table1":

CurrentDb.Execute "DELETE * FROM Table1", dbFailOnError

To import a text file, you can use the DoCmd.TransferText method --
details in the online help. If the text files are simple,
comma-delimited text, you don't need to do much more than that. If they
are fixed-field files, though, you need to tell Access how to parse them
into fields. You'll make your life simpler if you go through the manual
import process once, but before finishing the import, click the
Advanced... button on the import wizard dialog and save the import
specification. Then later, when you use DoCmd.TransferText to import
each file, you can specify the name of that import specification to tell
Access how to parse out the fields.

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)


 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to import several csv files into 1 access table? Chris Silvey Microsoft Access 4 29th Dec 2009 11:01 PM
Re: HELP! UPDATE command tsql syntax and sql access syntax Bob Barrows [MVP] Microsoft Access Queries 5 27th Aug 2008 09:43 PM
IMPORT MULTIPLE EXCEL CSV FILES INTO ONE ACCESS TABLE =?Utf-8?B?am9obm55X3Jpbmdv?= Microsoft Access External Data 1 19th Jun 2007 01:32 AM
Import files into Access Table Santa-D Microsoft Access 3 13th Jun 2006 12:38 AM
Import many csv files to different table in Access ecc28 Microsoft Access External Data 0 10th May 2004 09:20 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:43 PM.