Getting Access to Display the Attachment File Name

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sweet9red
    New Member
    • Nov 2013
    • 1

    Getting Access to Display the Attachment File Name

    Ok, so I have been working on a form that needs to have multiple attachments in it. (The easy part which I have already done; attaching the files.) The hard part which I will admit I am lost on, is displaying the name of the file not just an icon. Since the name of the attachment file contains alot of the information that I need, I need to see the name of the file.
  • twinnyfo
    Recognized Expert Moderator Specialist
    • Nov 2011
    • 3662

    #2
    sweet9red,

    Plesae provide a little more information (especially some sample code). From just reading your question, I surmise that you already have the file name (becuase you say that you are able to attach it).

    How do you want to display the file name? Plese provide a little more information and we'll be glad to take a look and try to guide you to a solution.

    Grace and peace,
    Twinnyfo

    Comment

    • ADezii
      Recognized Expert Expert
      • Apr 2006
      • 8834

      #3
      Let's assume you have a Contacts Database with a Photo Field (Type Attachment). To list all of the Attachment Filenames, along with the First and Last Names of the Contacts, and File Types:
      Code:
      Dim db As DAO.Database
      Dim rst As DAO.Recordset
      Dim rstComplex As DAO.Recordset2
      
      Set db = CurrentDb
      Set rst = db.OpenRecordset("SELECT * FROM tblContacts")
      
      Do Until rst.EOF
        Set rstComplex = rst!Photo.Value
          With rstComplex
            Do Until .EOF
            Debug.Print rst![FirstName] & " " & rst![LastName], ![FileName], ![FileType]
              .MoveNext   'Next Photo Attachment for Contact
          Loop
          End With
          Debug.Print "********************************************************"
            'Get the next Contact
               rst.MoveNext
      Loop
      'Close out
      rst.Close
      Set rst = Nothing
      Set rstComplex = Nothing
      Set db = Nothing

      Comment

      • zmbd
        Recognized Expert Moderator Expert
        • Mar 2012
        • 5501

        #4
        If you are using Outlook, and you want to do this within the email message, then this is a setting within Outlook, use the "plain text" format only. Icons and truncated filenames are the only way that the attachments will otherwise show within the program. Note this is a perclient/profile setting.

        Your only other option within the email, is to follow ADezii's example with the slight modification of adding the file names to the message body text instead of the immediates window.

        Comment

        Working...