Upload files through an Access form?

G

Guest

Hi!

I have created a form where user scan upload their files. Users select their
files with the function: ahtCommonFileOpenSave and this result is set into a
variable called “strInputFileNameâ€.

What I want is that the file will be copied to a directory, using FileCopy
or something else. At this moment, the filecopy function works like this:

FileCopy strInputFileName, "D:\Test" & ".xls"

But the problem is, that I have to give the destination a name as well, even
though users select different files, it will be named in the destination
folder as Test.xls

Does anyone know how I can get the name and extension of the source and put
this file with its original name and extension into another folder?

Kind Regards, Stefan van der Hooft.
 
M

Marshall Barton

Stefan said:
I have created a form where user scan upload their files. Users select their
files with the function: ahtCommonFileOpenSave and this result is set into a
variable called “strInputFileName”.

What I want is that the file will be copied to a directory, using FileCopy
or something else. At this moment, the filecopy function works like this:

FileCopy strInputFileName, "D:\Test" & ".xls"

But the problem is, that I have to give the destination a name as well, even
though users select different files, it will be named in the destination
folder as Test.xls

Does anyone know how I can get the name and extension of the source and put
this file with its original name and extension into another folder?


Assuming the original path/file actually exists, you can use
this trick:

FileCopy strInputFileName, "D:\Test" & Dir(strInputFileName)
 
G

Guest

Dear Marshall Barton,

Thank you for your reply, however I have one question left:
- The direction where MS Access copies the file is a protection folder,
where the users do not have access to. Is it still possible?

Kind regards, Stefan van der Hooft.
 
M

Marshall Barton

No. If anyone could copy files to a protected location,
what good would the protection be?

I suggest that you discuss this with your system
administrator to see if there is an alternative approach you
could use. If you are your system admin, then try asking
for ideas in an appropriate Windows forum.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top