• Copy user selected files to a specific destination (Access 2003 SP2)

    Home » Forums » AskWoody support » Productivity software by function » MS Access and database help » Copy user selected files to a specific destination (Access 2003 SP2)

    Author
    Topic
    #447485

    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?

    Viewing 0 reply threads
    Author
    Replies
    • #1091491

      1) You can use the old Basic instruction MkDir:

      MkDir “Test”

      will create a subdirectory Test under whatever the current directory (folder) is.

      MkDir “C:AccessTest”

      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

    Viewing 0 reply threads
    Reply To: Copy user selected files to a specific destination (Access 2003 SP2)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: