Import.csv file

ir26121973

New member
Local time
Today, 21:44
Joined
Mar 6, 2006
Messages
5
Hi,

I Am new to this forum and pretty new to Access, everything I know is self taught.

There has been an almost identical question to this, but being quite new to access I feel that the answer made need to be put in quite a basic format, so if someone could take a few minutes to look at this it would be geatly appreciated.

Bascially the problem I've got is that I have a shared e-mail folder where e-mails come in with attached .csv files. Is there any way that I could code a macro that automatically picks up the e-mails say every hour, open the attachment and save to my db.

many thanks

Chris
 
You need a Timer in your Access db that triggers a function that loops through all files in a folder.

You can loop through all files in a folder using the Dir() function.
You can read about Dir here:
http://www.dicks-blog.com/archives/2004/04/15/the-dir-function/

Then you can open the files that have not yet been inserted (You better keep track of that in some table) using for example:

Open strFile For Input As #1
While Not EOF(1)
Line Input #1, strLine ' Gets an entire line (ended by vbCrLf)
Input #1, strCSVPart ' Gets till the end of the line or till it encounters a , this can be handy if your CSV is comma seperated.
Loop
Close #1

You can read more about this here: (Need IE to view the code properly)
http://support.microsoft.com/?kbid=209231
 

Users who are viewing this thread

Back
Top Bottom