Avatar of thao-nhi
thao-nhi

asked on 

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

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
Microsoft Access

Avatar of undefined
Last Comment
thao-nhi

8/22/2022 - Mon