Results 1 to 2 of 2
2008-01-07, 20:13 #1
- Join Date
- Feb 2001
- Thanked 0 Times in 0 Posts
Copy user selected files to a specific destination (Access 2003 SP2)
I have created a database for which the purpose is to somewhat control the workflow of a design change notification. Each design change notice is assigned a unique number in the system. I'm currently stuck trying to figure out how to achieve the following.
When a user wants to add attachments to the Design Change ....
1) Create a subdirectory based on the design change notice assigned number.
2) Prompt users to select the required files and copy files into this assigned subdirectory
3) Have the files which were copied listed as hyperlinks for each design change notice.
4) Change the files a "read only" attribute.
Would all or any of this be acheivable using MS Access?
2008-01-07, 23:17 #2
- Join Date
- Mar 2002
- Thanked 29 Times in 29 Posts
Re: Copy user selected files to a specific destination (Access 2003 SP2)
1) You can use the old Basic instruction MkDir:
will create a subdirectory Test under whatever the current directory (folder) is.
will create a subdirectory Test under the folder C:Access (which must already exist).
Note: MkDir can create only one level at a time, it cannot create a path structure in one go.
2) You can use Application.FileDialog(msoFileDialogFilePicker) with the AllowMultiSelect property set to True to let the user select one or more files. Loop through the SelectedItems collection to retrieve the file names (and paths) of the selected files. Within the loop, use the Basic instruction CopyFile to copy each file to the destination directory.
3) You'd have to create a new record with the path and file name of each file in a separate table, linked to the main table by some kind of ID. You'd use a subform to display this table on the main form.
4) You can use the Basic instruction SetAttr to set the read-only attribute:
SettAttr strMyFile, vbReadOnly