Reputation: 64
Is There a Way to Turn a Column of File Names Into Link to That File in a .mdb File in Access?
I have an Access file with a column of file names, for example:
Column Name
cat.pdf
dog.pdf
happy.pdf
candy.pdf
The access file is within a folder called "example" There is a folder within example called "image"
All the pdfs referenced in the access file are in the image folder.
So
.
|--example
|----image
| |---cat.pdf
| |---dog.pdf
| |---happy.pdf
| └---candy.pdf
└----cdrom.mdb
I believed it would be as simple as prepending the entire column containing these file names with "image" but I could not find an efficient way to do that. I know how I could manually hyperlink each file name, but I've got hundreds that need to be converted to working hyperlinks to their files within the "image" folder.
Upvotes: 0
Views: 164
Reputation: 21379
In Access, a clickable hyperlink is composed of 3 parts separated by # character.
If you want a clickable link on a form, calculate in textbox ControlSource:
="#" & CurrentProject.Path & "\image\" & [fieldname] & "#"
Set textbox IsHyperlink property to Yes.
Link is clickable on report in ReportView, not PrintPreview. Exporting report to PDF should preserve clickable links in PDF.
If you want clickable hyperlink in table, table must have a field defined as Hyperlink type. An UPDATE action SQL can populate that field.
UPDATE table SET [hyperlink field name]="#" & CurrentProject.Path & "\Image\" & [filename field] & "#"
For other image types (png, jpg, bmp), calculation without # characters can be used in an Image control to display on form or report.
Upvotes: 1
Reputation: 56026
The path to those file should be:
PdfPath = CurrentProject.Path & "\image\" & [Column Name]
Upvotes: 0