Connecting Tech Pros Worldwide Forums | Help | Site Map

Preventing mulitple imports of a text file

Bob A
Guest
 
Posts: n/a
#1: Nov 12 '05
I do a weekly import of data from two text files, using two schema
files. I have automated the import process that gets the data from the
two files using a macro, and everything works great.

Every week the files are manually replaced by two new files of the
same name.

I would like to put a failsafe to prevent the files from being
imported more than once. Is there an easy way to accomplish this?
Perhaps automatically deleting the file after it is imported?

Thanks in advance.

--Bob

DFS
Guest
 
Posts: n/a
#2: Nov 12 '05

re: Preventing mulitple imports of a text file


"Bob A" <robert.aloisio@olympus.com> wrote in message
news:b0546a98.0401190820.4a795119@posting.google.c om...[color=blue]
> I do a weekly import of data from two text files, using two schema
> files. I have automated the import process that gets the data from the
> two files using a macro, and everything works great.
>
> Every week the files are manually replaced by two new files of the
> same name.
>
> I would like to put a failsafe to prevent the files from being
> imported more than once. Is there an easy way to accomplish this?
> Perhaps automatically deleting the file after it is imported?[/color]

That would work. Use the Kill command to delete the text file, or FileCopy
to a new name (eg XXXXX_imported.txt), then Kill the original.



[color=blue]
> Thanks in advance.
>
> --Bob[/color]


Larry Linson
Guest
 
Posts: n/a
#3: Nov 12 '05

re: Preventing mulitple imports of a text file


"Bob A" wrote
[color=blue]
> I would like to put a failsafe to prevent
> the files from being imported more than
> once. Is there an easy way to accomplish this?
> Perhaps automatically deleting the file after
> it is imported?[/color]

If you choose this, be sure to manually verify that the import worked and
didn't fail on some records before you delete the file.

I think, if I were doing this, I'd probably just move the file to a
different folder and append the date to its name (so it wouldn't conflict
with the other history files I was keeping there). See CopyFile, FileCopy,
MoveFile, Kill, and Rename statements in Access VBA Help if you want to
automate in VBA. I use macros so little that I don't attempt to discuss
macro techniques unless they are "patently obvious" to me.

Larry Linson
Microsoft Access MVP


Closed Thread