Results 1 to 3 of 3
  1. #1
    cuddles is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    May 2014
    Posts
    98

    Get Attachment Problem

    I am trying to code to allow users to attach a file however I am getting an error when I attempt to attach a .doc, .docx or .pdf. How do I make it so the me.txtpath allows for that?



    Code:
    Private Sub attachbtn_Click()
    Dim dlgOpen As FileDialog
     Set dlgOpen = Application.FileDialog(msoFileDialogOpen)
    With dlgOpen
     .AllowMultiSelect = False
     .InitialFileName = "Z:\" 'Initial Path when explorer is opened
     .Show
         If .SelectedItems.Count = 0 Then
           msgbox ("No file Selected") 'No file selected
         Else
            Me.txtPath = .SelectedItems(1) 'sets textbox on the form to the path selected
            'Me.img.Picture = txtPath.Value
         End If
      End With
    End Sub

  2. #2
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    Maybe you can adjust the Filter property of the FileDialog object. I usually clear it and then add back to it.

  3. #3
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    It looks like you're trying to populate a picture control. As far as I know you can only use image files there.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. Replies: 2
    Last Post: 01-29-2014, 11:55 AM
  2. Replies: 13
    Last Post: 12-05-2013, 06:04 PM
  3. Problem with append query for attachment field
    By ahmadrezaahmad in forum Queries
    Replies: 9
    Last Post: 06-29-2013, 09:08 PM
  4. Replies: 16
    Last Post: 04-30-2012, 07:12 AM
  5. Auto-populate and Attachment Problem
    By Davidyam in forum Access
    Replies: 3
    Last Post: 04-20-2012, 03:34 AM

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