Drag & Drop file to Access form (1 Viewer)

Steel

New member
Local time
Yesterday, 22:05
Joined
Oct 11, 2017
Messages
6
Hi,

I am looking for the capability to do the following:

  1. Drag a file into an Access Form
  2. Automatically save the file in a network drive
  3. Create a hyperlink in the Access form to that file so I don't have to include the file as an attachment

Apparently this is harder to do than I expected, or no one else ever needed to do this, because I can't find anything about it and I've been looking all over the place for some solutions :(

Any help would be appreciated!

Steel
 

sxschech

Registered User.
Local time
Yesterday, 19:05
Joined
Mar 2, 2010
Messages
789
Is the question that you would like to select a file or several files from location A and copy them to location B as well as save location B into a table as a hyperlink to be clicked on at a later point to open the copied file? Are the files of different formats or would they be one type such as PDF, DOCx or XLSx...? If the above then it can be done, my solution would not be drag and drop, instead, it would bring up a file dialog box where user would select one or more files which would then be processed. Also, would the files all be copied to the same place or does the user choose different places to save them or do files get saved to multiple places depending on type of file? (That would be a bit more complicated and my present code would need to be modified for that.)
 

Steel

New member
Local time
Yesterday, 22:05
Joined
Oct 11, 2017
Messages
6
Thanks for the reply.

I only need to do this for one file at a time.

Usually the files I'm working with exist in an e-mail as an attachment, they could be in various formats, but usually PDF, doc, tif files.

Also, it's ok if all files are stored in the same directory, but I don't want to go in and find them manually.

The hyperlink in the form will lead to the saved file so that I can reference it at any point by clicking on it in a subform that I have created.

There may be other ways to do this that I'm not aware of - you don't know what you don't know!
 

Steel

New member
Local time
Yesterday, 22:05
Joined
Oct 11, 2017
Messages
6
Thanks Ranman, this will definitely work if there isn't a way to auto save a file. My biggest concern with this is having to find the attachment I need, I'm probably going to be savings hundreds of attachments in the same directory, but that is another issue!
 

Steel

New member
Local time
Yesterday, 22:05
Joined
Oct 11, 2017
Messages
6
Thanks CJ, I did see that post, I just couldn't make any sense out of it...
 

Prodriguez

New member
Local time
Today, 10:05
Joined
May 1, 2013
Messages
11
Is the question that you would like to select a file or several files from location A and copy them to location B as well as save location B into a table as a hyperlink to be clicked on at a later point to open the copied file? Are the files of different formats or would they be one type such as PDF, DOCx or XLSx...? If the above then it can be done, my solution would not be drag and drop, instead, it would bring up a file dialog box where user would select one or more files which would then be processed. Also, would the files all be copied to the same place or does the user choose different places to save them or do files get saved to multiple places depending on type of file? (That would be a bit more complicated and my present code would need to be modified for that.)

Dear sxschech, the description of your code capabilities describes exactly what i need to with my form. Would you be able to share that code?
Thanks
 

sxschech

Registered User.
Local time
Yesterday, 19:05
Joined
Mar 2, 2010
Messages
789
Hi Prodriguez, would you be able to let me know which steps you'd like the program to go through as my original post had some "ors" in it so that I can see whether what I have will work more or less as is or needs modifications.
 

Prodriguez

New member
Local time
Today, 10:05
Joined
May 1, 2013
Messages
11
Hi Prodriguez, would you be able to let me know which steps you'd like the program to go through as my original post had some "ors" in it so that I can see whether what I have will work more or less as is or needs modifications.

Hi sxschech,

Thanks for your reply. These are the steps I need to perform in the VBA:

1) Select one or several files from one location A and copy them to a location B.

2) Save location B into a table as a hyperlink that can be clicked when required.

3) The files are of different formats.

4) The code you suggested is not a drag and drop but to bring a dialog box where the user can select the files which would work for my project.

5) Finally, the files would be saved to the same place.

I hope this helps.

Thank you
 

sxschech

Registered User.
Local time
Yesterday, 19:05
Joined
Mar 2, 2010
Messages
789
Here is a bare bones example for selecting one or more files, copying them to a new location and saving the filename with the path into a table. You will need to set a reference to Microsoft Office xx.x Object Library in Access. The notation for this is in the vba code of modFunctions. When you open the file it will display a button "Copy Files". Clicking on this will bring up the folder dialog to select the destination folder. After that, the file dialog will appear to select the file or files. Currently it is defaulted to xlsx, but there is a drop down to select all files. You can also edit the vba to change the default file types as well as the default starting folder. As this is a brief example, haven't included error checking or duplicate checking in the code, so if someone copies the file more than once, the file will show up in the table more than once.
 

Attachments

  • CopyAndSave.accdb
    416 KB · Views: 912

Apos1

New member
Local time
Today, 03:05
Joined
Nov 14, 2018
Messages
1
Dear all,

Till last week I could successfully drag and drop emails (Outlook) and files in Access 2010 32bit form, let them save on (copy to) the network with flex path (dependent on the meta data in the record) and save the hyperlink incl the metadata of the file(s). By Windows 10 update this ActiveX based solution is not possible anymore
. This I studied a lot of posts, websites, examples etc. either I can't find a workaround for Ms Access 2010 32B in combination with MS Win10 :banghead:

Anybody a suggestion?
 

vicsalt

Registered User.
Local time
Today, 02:05
Joined
Aug 22, 2008
Messages
48
Here is a bare bones example for selecting one or more files, copying them to a new location and saving the filename with the path into a table. You will need to set a reference to Microsoft Office xx.x Object Library in Access. The notation for this is in the vba code of modFunctions. When you open the file it will display a button "Copy Files". Clicking on this will bring up the folder dialog to select the destination folder. After that, the file dialog will appear to select the file or files. Currently it is defaulted to xlsx, but there is a drop down to select all files. You can also edit the vba to change the default file types as well as the default starting folder. As this is a brief example, haven't included error checking or duplicate checking in the code, so if someone copies the file more than once, the file will show up in the table more than once.

Ive been playing with your example for saving a link into a field in access. Your example asks for a location and then select the file. However I think my need is much simpler. I am creating a audit database, The auditor will scan and save the audit in a specific location. They will complete a form with dates and actions. I would also like to add the link to there scanned document,

Thus
click button
Select there corresponding scan from a predefined location. Access creates the short cut in the field.

I will then generate a report which includes audit information and link to actual audit document.

I hope this makes sense and would appreciate any support you can give
 
Last edited:

GPGeorge

Grover Park George
Local time
Yesterday, 19:05
Joined
Nov 25, 2004
Messages
1,762
Can someone who has UtterAccess access post the latest version here of DB found in the above link? I can't register for UtterAccess (confirmation email is never sent). Sorry if I shouldn't be asking this; just not sure what to do
I'll see what I can do to facilitate. Please PM here with details of the username/email you wanted to sign up with at UA.
 

Users who are viewing this thread

Top Bottom