473,326 Members | 2,175 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

Multiple File Manager

I would like to add an "attachments" option to my form that will allow users to upload files (e.g. Word documents, Excel spreadsheets, etc.) to a shared folder. I do not want the files to be stored as OLE objects in the database, but rather I would like to access the files from my form as either absolute references or hyperlinks. In addition, the user may want to upload more than one file, in which case I will need the solution to dynamically add more than one link to the form.

This is similar to Adobe Acrobat where there is an "Attachments" tab on the left side of the form that allows the user to attach multiple files to the .pdf file.

Thank you!
May 21 '07 #1
4 1945
cgrider
19
I would like to add an "attachments" option to my form that will allow users to upload files (e.g. Word documents, Excel spreadsheets, etc.) to a shared folder. I do not want the files to be stored as OLE objects in the database, but rather I would like to access the files from my form as either absolute references or hyperlinks. In addition, the user may want to upload more than one file, in which case I will need the solution to dynamically add more than one link to the form.

This is similar to Adobe Acrobat where there is an "Attachments" tab on the left side of the form that allows the user to attach multiple files to the .pdf file.

Thank you!

Here is the code I wrote to add pictures for a certain record this will also do any files type all depends on what the computer has to be open the program. I hope htis helps. if you have any questions please let me know.


Expand|Select|Wrap|Line Numbers
  1. Private Sub btnPgeAttachFile_Click()
  2. On Error GoTo command7_error
  3.  
  4.  
  5.  
  6. Dim vrtSelectedItem As Variant
  7. Dim strMyDir As String
  8. Dim strFilename As String
  9. Dim strNewpath As String
  10. Dim strReportNumber As String
  11.  
  12.  
  13. Set dlgOpen = Application.FileDialog(msoFileDialogFilePicker)
  14. Set fs = CreateObject("Scripting.FileSystemObject")
  15.  
  16. strCurrentPath = CurrentProject.Path & "\attachments"
  17. strReportNumber = Me.txtCaseNumber.Value
  18.  
  19.  
  20. If Dir(strCurrentPath, vbDirectory) = "" Then
  21.     MsgBox "The Attachments folder cannot be located", vbCritical, "ERROR"
  22.     GoTo command7_exit
  23.  
  24. End If
  25.  
  26.  
  27. With dlgOpen
  28.  
  29.     .Title = "Attatch File"
  30.     .AllowMultiSelect = True
  31.     If .Show = True Then
  32.         For Each vrtSelectedItem In .SelectedItems
  33.         strMyDir = vrtSelectedItem
  34.  
  35.         'this function grabs the file name of the selected file
  36.  
  37.         strFilename = Right(strMyDir, Len(strMyDir) - InStrRev(strMyDir, "\"))
  38.         strNewpath = strCurrentPath & "\" & strReportNumber
  39.         If Not fs.folderexists(strNewpath) Then
  40.             fs.createfolder strNewpath
  41.         End If
  42.  
  43.         fs.CopyFile strMyDir, strNewpath & "\"
  44.         strSQL = "insert into tblAttachments(attachment,attach,casenumber)  values ('" & strNewpath & "\" & strFilename & "','" & strFilename & "'," & strReportNumber & ")"
  45.         DoCmd.RunSQL strSQL       
  46.         Next vrtSelectedItem
  47.     Else
  48.         MsgBox "You clicked Cancel"
  49.     End If
  50. End With
  51.  
  52. command7_exit:
  53. Set fs = Nothing
  54. Set dlgOpen = Nothing
  55.  
  56. Me.lstPgeAttachAttachment.Requery
  57.  
  58. Exit Sub
  59.  
  60.  
  61. command7_error:
  62. MsgBox Err.Description
  63. Resume command7_exit
  64.  
  65.  
then all you have to do is create a list of sorts on your form that will show the all the files that the certain record has on it. and have it follow the link based on what they need choose if you need that code as well i can post it too.

CG
May 21 '07 #2
CG,

Thank you very much for the information and the quick response!

I am new to using Access, but I have used VBA extensively with Excel in the past, so I am starting to work through your code. It all seems fairly straight forward, but I want to make sure I understand the following line of code:

Me.lstPgeAttachAttachment.Requery

Does this line simply update the page titled "lstPgeAttachAttachment"?

Also, is there any way you can post a screenshot of your user query page?

Finally, would you mind posting the code for how to create a list of attachments on the form?

Thank you again!

Steve
May 21 '07 #3
CG,

I was able to resolve my issue by using a combination of your script, and the scripts posted by ADezii at the following link:

http://www.thescripts.com/forum/thre...yperlinks.html

Thank you again for your help,

Steve
Jun 15 '07 #4
cgrider
19
CG,

I was able to resolve my issue by using a combination of your script, and the scripts posted by ADezii at the following link:

http://www.thescripts.com/forum/thre...yperlinks.html

Thank you again for your help,

Steve
sorry I was not able to get back to you and i am glad you got it working.
Jun 18 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: yabba | last post by:
w2k server... after rebooting the event viewer/application log shows multiple restarts of Active Server Pages and they continue to build in memory as each start produces a IWAM_SERVERNAME in the...
11
by: Ohaya | last post by:
Hi, I'm trying to understand a situation where ASP seems to be "blocking" of "queuing" requests. This is on a Win2K Advanced Server, with IIS5. I've seen some posts (e.g.,...
11
by: Mike | last post by:
Looking to find any information on how to properly configure multiple instances of DB2. This is on Win2k db2 ver 7.2. I am basically looking for information on how the multiple instance settings...
6
by: Steve Mauldin | last post by:
I have three websites that were developed by using the same code in .net. They are all located under wwwroot on my desktop running windows 2000 pro.because Windows 2000 pro only supports a single...
4
by: vze1r2ht | last post by:
I have many types of classes and I'm deciding whether to use a single class or multiple classes for EACH type of class. For an example: User class has 3 classes associated with it: User...
3
by: Claudio Pacciarini | last post by:
Hi everyone, I have a question about .NET code sharing and reuse, and also about application design best practices / guidelines. Currently, we have many different .NET projects in source...
21
by: Al Christoph | last post by:
I posted this last week end in the MSDN forums. No luck there. Let's see what the experts here have to say:-)))) I have a rather convoluted project. The distributable will come in eight...
35
by: keerthyragavendran | last post by:
hi i'm downloading a single file using multiple threads... how can i specify a particular range of bytes alone from a single large file... for example say if i need only bytes ranging from...
4
by: =?Utf-8?B?bGpsZXZlbmQy?= | last post by:
I have a situation where I need to develop on two different computers. My solution is to simply save the project on a USB flash drive. Everything seems to work, except that the files that were...
3
by: =?Utf-8?B?bWljaGFlbCBzb3JlbnM=?= | last post by:
I have created a class library (DLL) that requires a certain XML file in the same directory as the DLL. This XML file is essentially a configuration or settings file but I want it to be a separate...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.