Results 1 to 10 of 10
  1. #1
    Modify_inc is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jul 2012
    Posts
    100

    Attachments to display their filenames

    I'm trying to figure out how to view the file names of attached files in Access 2010 using a Web Database, specifically the Contacts Web Database that is a template in Access.



    Currently it only shows one PDF icon for all my PDF files. I would like to be able to view the file names of all the PDFs in the attachment field. While I'm certain this can't be done within the same field as the attachment box (though would be nice), I would think it would be possible to populate another field with this information.

    I have experimented with different things with no luck using a new standard database for testing purposes. The closest I've come was using the SubForm/SubReport; it actually gave me the values for the attachment as you can see in the picture below.

    But even then, it did not work and gave a error: Invalid Control Property: Control Source


    Click image for larger version. 

Name:	Access Attachment Fail SubForm.SubReport Standard.jpg 
Views:	12 
Size:	24.7 KB 
ID:	10589Click image for larger version. 

Name:	Access Attachment Fail Standard.jpg 
Views:	12 
Size:	161.3 KB 
ID:	10590

    Any Suggestions? I should mention I am a novice at Access, so when I say "I experimented with different things", assume that I'm clueless newbie.

    Thanks
    Mike

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,913
    I don't know about web database but in a regular database I had no problem creating a form or report to display the multiple attachments. Did not even need subform/subreport. I just created a query that included the attachment field subdata. Then I used the field list to drag those fields onto the form, seems to work better then trying to manually set ControlSource in a textbox control.
    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.

  3. #3
    Modify_inc is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jul 2012
    Posts
    100
    Quote Originally Posted by June7 View Post
    I don't know about web database but in a regular database I had no problem creating a form or report to display the multiple attachments. Did not even need subform/subreport. I just created a query that included the attachment field subdata. Then I used the field list to drag those fields onto the form, seems to work better then trying to manually set ControlSource in a textbox control.

    Yes the query works, I just tried it, thanks.

    I'm not sure what you mean by you "used the field list to drag those fields onto the form."

    I'm stuck at the query. I have the output of the filenames but not sure how to put them in my form.

    Do I need to create a macro to call the query or is there a more efficient way?

    The way I understand query's is they only run when executed, so If I just copy the results of the query to my form, the file names will be static and not change when the files are updated in the attachment field.

    Still learning here...

    Probably over simplified but it looks like you could just add a line of code to a label or text box in the form that says something along the lines of this:

    Display tblContacts.ID3.Field3.Filenames

    Is something like this not possible? Just seems like a lot of work to do it any other way.

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,913
    If a query object is referenced as the RecordSource for a form or report, the query 'runs' when the form or report is opened. In my test I actually built the SQL right in the form's RecordSource, did not reference a query object.

    With form or report in design view, click the AddExistingFields button on the Design tab. This will list fields from the RecordSource.

    No, code like that not possible in controls. Set textbox ControlSource property to field of the form/report RecordSource. Use the 'drag from field list' method.
    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.

  5. #5
    Modify_inc is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jul 2012
    Posts
    100
    Quote Originally Posted by June7 View Post
    If a query object is referenced as the RecordSource for a form or report, the query 'runs' when the form or report is opened. In my test I actually built the SQL right in the form's RecordSource, did not reference a query object.

    With form or report in design view, click the AddExistingFields button on the Design tab. This will list fields from the RecordSource.

    No, code like that not possible in controls. Set textbox ControlSource property to field of the form/report RecordSource. Use the 'drag from field list' method.
    Hey, thanks again for the reply!

    I was able to list one of the two attachments I have in the attachment box but not entirely the way you stated. Under Add Existing Fields and selecting the Field3.FileName and dragging it to my form worked, although this method only displays one attachment not all of them. Actually after further testing, it does display the other attachment, only though after selecting the next record which means it's creating a duplicate record just to show the other attachment. Ideally I need the attachments to be listed entirely on their one relative record, not on a bunch of duplicate records with only the attachment name listed differently.

    I'm not sure how to integrate the qryAttachments into the RecordSource and still have the tblContacts also as a RecordSource. If I use just the query as the RecordSource, it causes issue with the rest of the form functionality.

    Also I noticed that the query list all attachemnts, even attachments of other records. Maybe it's just the way I coded the query to run, I will check it again. If not, then this will not work, as I only need the query of the attachments file names for the given record.


    Mike

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,913
    Attachment field is a type of multi-value field. True nature of multi-value field is it is really storing the data as separate records in a hidden system table. I never use multi-value fields.

    Displaying multiple attachments requires 'expanding' the field and essentially creating a record in the query for each attachment. Which is the same as would be done if the attachments were saved as individual records in a normal child table.
    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.

  7. #7
    Modify_inc is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jul 2012
    Posts
    100
    Quote Originally Posted by June7 View Post
    Attachment field is a type of multi-value field. True nature of multi-value field is it is really storing the data as separate records in a hidden system table. I never use multi-value fields.

    Displaying multiple attachments requires 'expanding' the field and essentially creating a record in the query for each attachment. Which is the same as would be done if the attachments were saved as individual records in a normal child table.
    Ok, I think I've decided to abandon the web database type for the standard. I just keep hitting to many roadblocks, and most people are not that familiar with them or their exact limitations when I ask around. My latest frustration is it looks like it doesn't work with ActiveX Controls. I knew VBA was gone, leaving only macros, unless there's other ways to code around these limitations.

    I found this useful application, AccessImagine, that works great for attaching photos in Access, but it appears to require you to select the ActiveX Control to select it from the list. This worked great when testing it in a standard database, but soon as I tried it in my web database, I noticed the ActiveX Control was grayed out. My understanding is ActiveX Control only works in Design mode and web databases don't have Design mode, but only the Layout View, and supposedly it's suppose to be "Enhanced" as MS states.

    The only reason I used the web database design was because the Contact template that is provided with Access 2010 works great for my database design.

    Does anyone know if there is a way to convert to standard or where to locate a Contact template similar to the one in Access?

    Thanks
    Mike

  8. #8
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,913
    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.

  9. #9
    Modify_inc is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jul 2012
    Posts
    100
    Thanks I had seen that, but I was concerned because it states it is for Access 2007.

    Anyhow thanks for your help thus far.

  10. #10
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,913
    The Access 2007 file should run just fine under Access 2010.
    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. Photos.FileNames Attachments
    By FrustratedAlso in forum Access
    Replies: 8
    Last Post: 04-04-2012, 01:36 PM
  2. Display every attachments in report?
    By mitchel in forum Reports
    Replies: 7
    Last Post: 02-11-2012, 07:53 PM
  3. Attachments
    By JayX in forum Access
    Replies: 5
    Last Post: 12-27-2011, 03:08 PM
  4. Exporting Quieres - Filenames
    By jquickuk in forum Programming
    Replies: 1
    Last Post: 05-02-2009, 06:51 PM
  5. Adding filenames to pictures
    By Plumber in forum Forms
    Replies: 1
    Last Post: 02-11-2009, 10:34 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