troubleshooting Question

Loading default image if the image is not found in external folder

Avatar of thao-nhi
thao-nhi asked on
Microsoft Access
6 Comments1 Solution109 ViewsLast Modified:
I want to load a default image if the specified image is not found. Below are my code in form load event.
The image file name will be the Workorder_ID & the file extension. Images in the external folder are named that way. In the event that the images are not available, I want the controls ImgHolder1.Picture & ImgHolder2.Picture  to load the same default photo.  Help with vba code preferred. Thanks

Dim ImgPath As String
Dim ImgFile As String
Dim ImgFile1 As String
Dim ImgFile2 As String

ImgPath = "D:\Img\"
    ImgFile = Me.Workorder_ID
    ImgFile1 = ImgFile & "F.png"
    ImgFile2 = ImgFile & "B.png"
    ImgHolder1.Picture = ImgPath & ImgFile1
    ImgHolder2.Picture = ImgPath & ImgFile2
Join our community to see this answer!
Unlock 1 Answer and 6 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 6 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros