Save report to pdf and insert in a table

mtawfik

New member
Local time
Today, 11:17
Joined
Nov 16, 2017
Messages
5
Hi all

I am using MS Access 2016

After issuing a report I export using below code:
DoCmd.OutputTo acOutputReport, "reportname", acFormatPDF, FilePath


I need help for the next step to import this exported file (PDF) and save in a table in my access DB.

Or using another scenario to convert the report to pdf and save in the database without exporting to OS.

Thanks in advance
Mohamed
 
Save what in your table? File path?

The whole point of saving a report as a PDF is to create an external file as a snapshot of the data at a particular time. You can't save a PDF within your database other than as an attachment field which I strongly advise you not to do
 
To amplify Colin's comment... all you need is the file name to open it via hyperlink. If you attempt to embed the file (a la' OLE insertion), you QUICKLY bloat your database file because a link is usually less than 128 bytes, but certainly less than 255 bytes. For a PDF, 255 bytes won't even get you the block that contains the infrastructure info. But if the link to the file is in the DB and the PDF is outside the DB, not a big space issue at all. And the reason why this worries you is that an Access DB has a 2 GB limit. It takes a lot longer to fill up a DB with file specs than it does to fill it up with actual files.
 
To add to what the others have posted,

1) If saved in the database, how do you plan to display the information? This is often much more difficult than simply allowing windows to use the default program to display.

2) If saved in the database, how to do you plan to share? Once more if its is simply a file it is easy to copy, email, or link to from a web page. Inside of a database it is much more difficult.

3) If saved in the database, what are your plans if you need to re-run the report? Will you have different copies for the same period or delete one? As a file on disk this is very easy to deal with.

There are good reasons to have a file within the database, but I would first do a comparison of the advantages to the disadvantages. Most often you will find the disadvantages exceed the benefit.
 
Thanks for your reply, I appreciate your technical view for database size but This database stored limited documents.
Also this database is annually closed, I have capacity planning for further data size and we are safe.
I just looking for vba code allow me to upload pdf as an added feature,
Thanks
 
Thanks for your reply, I appreciate your technical view for database size but This database stored limited documents.
Also this database is annually closed, I have capacity planning for further data size and we are safe.
I just looking for vba code allow me to upload pdf as an added feature,
Thanks

You may think that but the increase in database size for each attached file is usually FAR BIGGER than the actual file size. You may not believe this will happen but your database will rapidly become enormous and performance will suffer LONG before you hit the 2GB limit. If you do hit it, you will be unable to open your database at all

Attachment fields have almost no benefits & lots of disadvantages.

Therefore,I'm not even going to tell you how to use an attachment field

If you want to view an external PDF within Access, use a web browser control
 

Users who are viewing this thread

Back
Top Bottom