How to link or attach a pdf file in access database? (1 Viewer)

Abeetan

Member
Local time
Today, 20:51
Joined
Nov 30, 2021
Messages
39
Hello all,

I wanted to know what is the proper way of linking a pdf file that is stored on my PC in a folder to each record. For example, a pdf of a receipt for each order (a record) goes in a field. I have done something as adding a hyperlink in the field but I hear there is a better approach. Please advise. Thank you.
 

theDBguy

I’m here to help
Staff member
Local time
Today, 10:51
Joined
Oct 29, 2018
Messages
21,358
Hi. The recommended approach is to store the file path to the file in a Text field.
 

Abeetan

Member
Local time
Today, 20:51
Joined
Nov 30, 2021
Messages
39
Hi. The recommended approach is to store the file path to the file in a Text field
Do you happen to have a YouTube video demonstrating an example? I have failed in the past storing a file path as a text field I am definitely missing something or doing it wrong. Does the datatype have to be a hyperlink?
 

theDBguy

I’m here to help
Staff member
Local time
Today, 10:51
Joined
Oct 29, 2018
Messages
21,358
Do you happen to have a YouTube video demonstrating an example? I have failed in the past storing a file path as a text field I am definitely missing something or doing it wrong. Does the datatype have to be a hyperlink?
The field's data type can just be Short Text. What do you mean by "failed?"
 

Abeetan

Member
Local time
Today, 20:51
Joined
Nov 30, 2021
Messages
39
The field's data type can just be Short Text. What do you mean by "failed?"
I am unable to link the file, it won't open. It's just stored as text. I can't click on it and open the file. Or even worse, access says it can't find the file.
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 13:51
Joined
Feb 19, 2002
Messages
42,971
Store the full path to the file
Use the FollowHyperlink method to open it. As long as the file extension is known to Windows, Windows will know what application to use to open the file.
 

theDBguy

I’m here to help
Staff member
Local time
Today, 10:51
Joined
Oct 29, 2018
Messages
21,358
I am unable to link the file, it won't open. It's just stored as text. I can't click on it and open the file. Or even worse, access says it can't find the file.
Okay, first of all, I hope you're clicking on it on a form and not in a table. The code you could try to open the file could be something like:
Code:
Application.FollowHyperlink Me.FieldName
Edit: Oops, too slow...
 

Users who are viewing this thread

Top Bottom