Printing multiple jpgs per record to a report

darren_access

Registered User.
Local time
Today, 07:37
Joined
Jan 8, 2018
Messages
57
Hello comrades,

I'm very new to ACCESS and have done a search on the web and on here for a quick resolution to this issue, to no avail.

I have created an app to allow a user to input records into 2 tables: a project table (master) and lineitems table (details).

The project table contains info such as project name, engineer, contractor etc.
The Lineitems table contains equipment being submitted as part of the bid. Each item has dimensions etc plus an attachment field to contain the spec drawings. some items have multiple spec dwgs though. not a problem when it comes to entry.

the report prints a page with some detail info on top of the spec drawing image so that an engineer can refer that dwg back to his project and piece of equipment.

problem is, many items contain multiple shop drawings per record. i've noticed that it prints only the first image, not the others, or repeats the first image multiple times instead of the other attachments.

What I want to happen is for each item record, print all the attachments one after the other before moving onto the next record.. the attachments are named as "product_name_page1.jpg","product_name_page2.jpg" etc.

Is there a reason, fix, or workaround for this?

Thanks in advance!
 
problem is, many items contain multiple shop drawings per record. i've noticed that it prints only the first image, not the others, or repeats the first image multiple times instead of the other attachments.

You posted that you have a "Project" table and a "LineItem" table. If you can have more than one image per "Lineitem", what are you saving them in? This should be a child table to "LineItem" so you have ONE "Attachment" record per attachment.

You would them simply have a subreport that runs on your "Attachment" file.
 
You posted that you have a "Project" table and a "LineItem" table. If you can have more than one image per "Lineitem", what are you saving them in? This should be a child table to "LineItem" so you have ONE "Attachment" record per attachment.

You would them simply have a subreport that runs on your "Attachment" file.

The images are saved in the attachment fld called "fld_attachments" that is capable of uploading multiple images quite nicely with the inherent dialog box. This simplicity is nice and i'd like to stick with that.
 
I would advise against doing this for several reasons;
1) These files are added into your database so the physical size of your database file grows immensely.
2) This is not supported in other back ends. If you need to grow your system you will need to change this.
3) As these images and documents are saved in your database, you will need to compact/repair often, especially if your source documents are edited.
4) As they are in your database they cannot be accessed from outside of access. This means you will start having redundant copies and need to ensure version control.

A better option is to have a child file with a pointer to the parent, the name of the document (optional) and a string holding the full path. Not only would this allow you to easily report on the file but you could also have the default program (or another, if said program allows command line parameters for file) open the attachment to edit the file.

Saving inside your database limits what you can do while adding excessive space usage.
 
I would advise against doing this for several reasons;
1) These files are added into your database so the physical size of your database file grows immensely.
2) This is not supported in other back ends. If you need to grow your system you will need to change this.
3) As these images and documents are saved in your database, you will need to compact/repair often, especially if your source documents are edited.
4) As they are in your database they cannot be accessed from outside of access. This means you will start having redundant copies and need to ensure version control.

A better option is to have a child file with a pointer to the parent, the name of the document (optional) and a string holding the full path. Not only would this allow you to easily report on the file but you could also have the default program (or another, if said program allows command line parameters for file) open the attachment to edit the file.

Saving inside your database limits what you can do while adding excessive space usage.

cool, your arguments make sense. I wasn't aware of the size limitations. If i set up an attachment table linked to the lineitems table, can I still use the attachments field type/dialog? does it allow for storing only name and path as you suggest?
 
in the meantime I would still like to use the current functionality by loading the attachments into the db using the attachment field as one field if at all possible. this would get me to beta phase this week at least. I am hoping that there's an easy fix regardless of the caveats.
 
here is a crude report with multiple attachments per lineitem.
study the Query where the report is based.
see the code of Report's Detail Format.
if you want to see only one line item then the
varios pics, create a group. on Project then
again on ID of the lineitem table.
 

Attachments

here is a crude report with multiple attachments per lineitem.
study the Query where the report is based.
see the code of Report's Detail Format.
if you want to see only one line item then the
varios pics, create a group. on Project then
again on ID of the lineitem table.

thanks for the snippet. it confirms my method is on track for the most part. i am seeing the filenames show up accurately for each record "...1.jpg", "...2.jpg" etc, but my image control is not toggling the image. it repeats the first image in the record only.
 

Attachments

  • screenshotofduplicateimages.jpg
    screenshotofduplicateimages.jpg
    96.9 KB · Views: 137
Still no joy getting the app to iterate through each image even though the attachment.filename does.

as a workaround i have created an attachments table with a lineitem key, attachments field and a couple other fields to store attachment name and path. I figure i entry per attachment, so i need a multi row form to appear in a pop up window prepopulated with the lineitem key value, project id.

1. How can I make it open the attachment form in a small window from a button in the line item entry form instead of jumping to another tab altogether? Then a close() button so the user is still at the line item form.

2. is it necessary for me to have created the filename and path fields or not?

Thank you! :)
 

Attachments

  • aaaa.jpg
    aaaa.jpg
    99.3 KB · Views: 136
  • bbbb.jpg
    bbbb.jpg
    90.5 KB · Views: 131
@Darren,
I would HIGHLY recommend not using the attachment field itself. I've attached a sample database that allows you to select a file that works properly.

If you place documents inside your database, especially multiple images per "Attachment", you will run into Access's limit of 2gb file limit.

As you can set an image controlsource to a text field, it is very easy to let Access do the work for you for displaying images.
 

Attachments

@Darren,
I would HIGHLY recommend not using the attachment field itself. I've attached a sample database that allows you to select a file that works properly.

If you place documents inside your database, especially multiple images per "Attachment", you will run into Access's limit of 2gb file limit.

As you can set an image controlsource to a text field, it is very easy to let Access do the work for you for displaying images.

THANKS!

I have SUCCESS now. I am only using the attachment.filename and an image object on the report and it is working. it is iterating through each page successfully in order.

the only other hiccup I encountered was attaching files from different folders wasn't working. it would only print items from the first folder then blanks from then on. Solved this by placing all images into a central folder.

Thank you everyone for the help. It was a real head scratcher for me :)

As for the 2 GB limit, I know I will hit that wall after about 100 documents, so i do plan on breaking it out as you demonstrated. for now this will get me past the initial deadline. I'll have a lot of breathing room as each user will use their own version and produce about 30-50 docs in a year.
 

Users who are viewing this thread

Back
Top Bottom