saving a pdf file into a string field on an access form (1 Viewer)

atrium

Registered User.
Local time
Tomorrow, 10:22
Joined
May 13, 2014
Messages
348
I have a contact log in our system used to record all actions taken with our clients. I maintain all the relevant info and the action taken field is a string field (Long) and users want to be able to save pdf files in the action taken field - how can I do it ?
 

strive4peace

AWF VIP
Local time
Today, 18:22
Joined
Apr 3, 2020
Messages
1,003
hi @atrium

a PDF file is an object, not a string

Perhaps you want to keep the file external and store the path\file -- then you can use a web browser control to view it

You can also use an attachment field ... but I prefer not to drag files into an Access database
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Tomorrow, 07:22
Joined
May 7, 2009
Messages
19,169
You can create a Filtered query that will output the specific Action.
You can use docmd.outputto to create a pdf against this query. You can even create a report and Output as pdf.
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 19:22
Joined
Feb 19, 2002
Messages
42,978
I would go with Crystal's first suggestion. Store the PDF in a shared folder and log the name and location in the table. Storing objects in a table soon bloats the database.

To make the shared directory easier to use on its own, I would probably create separate folders for each client. You can store the name of the client folder in the client record. Create the folder at the time a new client is added or create it on the fly as documents are added if they don't exist, whichever makes the most sense. Separating the path from the file name also saves space. The path is stored once in the client record so the field in the log only needs to store the file name.
 

strive4peace

AWF VIP
Local time
Today, 18:22
Joined
Apr 3, 2020
Messages
1,003
adding on ...

I usually hang directories under the back-end location, organized under a Files folder -- then even if the path to the back-end is referenced differently for various users, the application can get the back-end path from the connect string of one of the linked tables. Then a relative path to the top level path for files can be used. In my databases, if a path starts with "\", it's a relative path to CurrentProject.Path\Files, not absolute

Generally then, when a file is chosen, it is either moved or copied to this area under the back-end.
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 19:22
Joined
Feb 19, 2002
Messages
42,978
Most of my BE's are SQL Server or some other RDBMS so that doesn't work for me:)
 

strive4peace

AWF VIP
Local time
Today, 18:22
Joined
Apr 3, 2020
Messages
1,003
yes, that only works while the database back-end(s) is still in Access -- or on the network anyway since Access can link to other types of files as well
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 19:22
Joined
Feb 19, 2002
Messages
42,978
The database server is never used to store files though so with a RDBMS, you don't have anything to hang your hat on so I just store the path in a relevant record. However, using the UNC path is better than storing the drive letter since that gives you the most flexibility and prevents errors in shops where you have trouble finding a common drive letter you can use.
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 18:22
Joined
Feb 28, 2001
Messages
27,001
Directly responding to @atrium - whatever you do, DON'T try to actually store the file in an Access database. Crystal's suggestion is good. Pat already supported it and I will too. Store the fully qualified file specification in that text string. Set aside a folder in your infrastructure to hold files of this type. Then your action log with respect to the .PDF file you wanted to save would be to state "Saved file dev:/path/.../file.type" - and since you would have a fixed format, you could find the words "Saved file" and just ignore them to recover the file. (That's one way to do it. There are many more ways to skin this cat.)
 

atrium

Registered User.
Local time
Tomorrow, 10:22
Joined
May 13, 2014
Messages
348
Thanks everyone for your input.

I have used Crystal's solution before and I will use it again, it does the job and looks like the only method to use.
 

Users who are viewing this thread

Top Bottom