CptTom:
I'm pretty sure you can't use the FileCopy function in that manner. You can use it to copy all the files from one directory to another (using the wildcards for Source), like this:
Code:
strSource = "C:\Data\*.dat"
strDestination = "c:\complete\"
FileCopy strSource, strDestination
which would move *.dat from C:\Data\ to your complete folder, but this isn't what you want.
What I'd do (and unfortunately I hate this) is Open a new file for Output (on first go, then append) and open and close each file and concatinating each into the a destination file. (Looping through each line until EOF and using
Line Input # and
Print #)
This should work on straight Ascii files.
The problem with this is- Access doesn't like binary data. I tried doing something similar while trying to build a program to concatinate many binary (but sequential) files togethor- doesn't work. Cuts them short, and the final product won't be what you want. I ultimately re-wrote my program just to output a shell string (Copy /b f1.txt+f2.txt+f3.txt) and etc, to the debug window, and used that in a dos shell. No, not eligant, and definately not professional for other users, but for myself, it worked.
However, if it's straight ASCII you're using, you shouldn't have a problem.
If it IS Binary data, I think I might have a reference for a solution, albeit, not a very nice-and-easy one for you- it's going to take a little research, but it's research that you may find enlightening if you haven't been exposed to API calls much:
If you absolutely must get it done, an Invaluable reference sight for more advanced programming (working with the Windows API), and the best VB API site I've found yet, is
www.vbapi.com
Follow the Reference link, click Function Information...By Category, and under Files, you should see the links for infomration on the API calls for ReadFile and WriteFile. These will use buffers to read in, and write out the data you're trying to open. (The write also uses the CreateFile and CloseHandle APIs. Make sure you DO USE THE CloseHandle api call!)
If you knew about all that, and were just looking for some simple code Access might use, I'm sorry- I don't know of any.
However, this solution should do it. I haven't used this specific technique yet, but I'm planning on taking a look at it shortly. If I come up with some nice efficient code to handle your question (which eventually is what I want to do get anyhow) I'll post it.
-MoGryph
[8O)