Solved

Macro to import ascii files into a table

Posted on 2004-09-07
4
390 Views
Last Modified: 2011-04-14
I have a large number of  ascii files stored in a folder c:\tmp.
Each file has four columns seperated by tabs. There is no header row.  

Here are a few rows from one file:
08/13/2004      AAC.AX      1.4      7212730
08/16/2004      AAC.AX      1.4      675351
08/17/2004      AAC.AX      1.4      161616

I want to import the contents of these files into a single table, using the same column order.  

Is there a quick and easy way to do this using Access VBA?

Thank you!
0
Comment
Question by:tomfolinsbee
  • 2
4 Comments
 
LVL 7

Assisted Solution

by:_agj_
_agj_ earned 250 total points
ID: 11996673
u can combine all of these into a single file using a batch command like:

cd c:\tmp
for %f in <*.*> do type %f >> all.txt


now u can just open this, select all the text and copy paste into an access table.
0
 

Author Comment

by:tomfolinsbee
ID: 11998387
Thanks agj, I didn't realise you could thing like that with the Dos prompt!

I typed it typed it in exactly as above, including spaces and got this message:

< was unexpected at this time

In case that makes in difference,  I'm using Windows XP and the file names look like this:  AAC.AX_D


0
 
LVL 32

Accepted Solution

by:
Erick37 earned 250 total points
ID: 12002714
To correct the DOS syntax, the line from agj should read:
for %f in (*.*) do type %f >> all.txt

Would you prefer a VB solution?
0
 

Author Comment

by:tomfolinsbee
ID: 12002856
Thanks agj and Erick37!
0

Featured Post

Does Powershell have you tied up in knots?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Access 2003, my txt file export is running backwards 4 52
MsgBox 2 57
SQL VB connection works in one PC and doesn't in another 15 64
Send outlook email from VBS Script 2 30
There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

803 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question