Results 1 to 2 of 2
  1. #1
    jcalvin00 is offline Novice
    Windows 10 Access 2016
    Join Date
    Apr 2018
    Posts
    1

    Creating a Form for user submission with attachments


    Hello,

    I am no expert and I am in the process of learning along the way. I am currently building a form that is intended to be used for submission of data and documentation by users. The information entered on the form will be saved to a temp table. I am trying to figure out how to create a button that will allow you to browse for files and place the files selected in the attachment field on my temp table. I have the button set up with the following code, but it is not working. I know storing actual attachments in the database itself is not the best, and I would preferably want to create a browse button to select a file, and then automatically save the selected file to a specific folder. Any help on both of these ideas is much appreciated.

    Private Sub Command435_Click()
    Call Selectfile


    End Sub
    Public Function Selectfile() As String


    Dim Fd As FileDialog
    Set Fd = Application.FileDialog(msoFileDialogFilePicker)
    With Fd
    .AllowMultiSelect = False
    .Title = "Please Select File"
    If Fd.Show = True Then
    Selectfile = .SelectedItems(1)
    Me.Attachments = Selectfile


    Else
    Exit Function
    End If
    Set Fd = Nothing

    End With



    End Function

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,618
    Embedding files in db can quickly use up Access 2GB size limit.

    Attachment field is a type of multi-value field. Requires special code using recordset objects to programmatically manipulate attachment field. Review http://sourcedaddy.com/ms-access/wor...nt-fields.html

    If you just want to copy file to another folder, that is simple. Use intrinsic CopyFile function. In VBA editor, set a reference to the Microsoft Outlook x.0 Object Library.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Multiply entries from one form submission
    By Mr Anderson in forum Access
    Replies: 12
    Last Post: 01-25-2018, 01:31 PM
  2. Replies: 7
    Last Post: 03-07-2017, 02:10 PM
  3. Creating a Form with Attachments
    By jjedlicka in forum Forms
    Replies: 3
    Last Post: 10-07-2014, 01:38 PM
  4. creating Form like as user Receipt
    By sankar519 in forum Access
    Replies: 6
    Last Post: 06-11-2014, 06:33 AM
  5. Add Line to Form Submission
    By kagoodwin13 in forum Forms
    Replies: 1
    Last Post: 02-21-2013, 10:46 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums