We help IT Professionals succeed at work.

Correct file import button

rtod2
rtod2 used Ask the Experts™
on
MS Access 2010 question,

The file import button in the form of the attached database is supposed to import picture.png files, and match it up with the correct study.  When it was originally set up, it looked for png files in a relative path for the folder named /Attachments.  Originally, I had a space between the name of the file and the extension.  That issue has been corrected, and the button no longer works as a result.

Assistance is greatly appreciated.
TOS-Studies-v1.11.accdb
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
There are two possible ways:
1. In Button's code replace string:
fname = Path & "\" & rs!STUDY & ".png"
with
fname = Path & "\" & Trim(rs!STUDY) & ".png"
2. Create query:
UPDATE StudyDetails SET StudyDetails.STUDY = Trim([STUDY]);
and run it once.

I prefer variant 2, because in this case files can have spaces in the end of name (as it was in uploaded pictures). In variant 1 you will never find this file.

Author

Commented:
Exceptional.  Thank you for the very clear solution.