Is this even possible???

ACE

Registered User.
Local time
Yesterday, 23:06
Joined
Aug 21, 2003
Messages
18
:confused: Hi, I'm trying to do something here in Access and I'm not sure if it's possible. I want to take 165 txt files and merge them together in Access. They are all in their own folder with the same filename. They are created daily and will have 24 records each. How can I go about doing this??? Thanks for the help!!
 
You could read the directory in VBA, pull the file names and import each one.
 
Hi Fofa,

I also need each record from every file to be named the same (in an extra column) as the folder that it came from. Thanks for your response!!
 
Its really easy enough... (if you know how)

Using the dir command you can find the folder name first (put that into a variable)
then from that foldername run an import textfile...
add that to a table that has all necessary columns + 1 (your folder name thingy)
Then run an update query "where FolderName is null" foldername = Variable....

loop that for every folder, done....

Regards

P.S. Its pretty pseudo code, if you cant figure it. Post back i might just take the time to throw something together for ya....
 
Hi Namliam,

Thanks for the offer and for the help!! I want to try to do this on my own, I have to learn how to do stuff like this somehow!! I'll let you know how I make out in a few days and I might take you up on your offer if I'm just not getting anywhere.

Thanks again!!
 
Hi Namliam,

O.K., maybe I just need a little bit of help getting started here!! It's hard to learn this stuff when you don't even know where you should be starting!!!
 
First find out about Dir
How to use it to find the directory and store it in a variable --eg myDir-- (and loop) --- Hint: Look it up in the access help

Then find out how to import a text file --- Access help again
Then try to figure out how to combine myDir and text file name to be able to make the import flexible--- Hint: &, and plenty samples on "Concatinating" on the forum

Now work out how to run an update query from code --- easy one, i will give you that one: Currentdb.execute "Sql here" Paste the SQL from the QBE

Now try and make that SQL flexible again with myDir

Lastly combine all above in a loop, and your done....

Regards

The Mailman

P.S. Heading home now....
 

Users who are viewing this thread

Back
Top Bottom