troubleshooting Question

Access VBA change an image on a different form

Avatar of Murray Brown
Murray BrownFlag for United Kingdom of Great Britain and Northern Ireland asked on
Microsoft Access
3 Comments1 Solution69 ViewsLast Modified:
Hi. I have two forms. The first loads an image in the following event. The second has a button where the image can be edited. My problem
is that when I do this and go back to the first form the old image is there. I have tried to reload the image and refresh the form but it doesn't work


Private Sub Form_Current()
   Dim oDB_Folder As String: oDB_Folder = CurrentProject.Path
    Dim oSavedPath As String: oSavedPath = [PhotoFile]
    Dim oActualPath, F As String
    F = Replace(oSavedPath, "DatabaseFolder", oDB_Folder)
   Me.imgPhoto.Picture = F
End Sub

Private Sub btnSelectPhoto_Click()

    Dim strFile As String
    Dim PhotoFile As String
    strFile = GetFileName(CurrentProject.Path)
    If strFile > "" Then
        PhotoFile = Filenm(strFile)
        If Filepath(strFile) <> CurrentProject.Path & "\Media\ID Photos\" Then
            FileCopy strFile, CurrentProject.Path & "\Media\ID Photos\" & PhotoFile
        End If
        imgPhoto.Picture = CurrentProject.Path & "\Media\ID Photos\" & PhotoFile
        Me.PhotoFile = "DatabaseFolder" & "\Media\ID Photos\" & PhotoFile
        Form_f_LicenseeDetailsEdit.PhotoFile = "DatabaseFolder" & "\Media\ID Photos\" & PhotoFile
        Form_f_LicenseeDetailsEdit.Refresh
        Form_f_LicenseeDetailsEdit.Repaint
    End If
    
End Sub
ASKER CERTIFIED SOLUTION
ste5an
Senior Developer

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 3 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 3 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