Image/Form Refresh/requery issue (1 Viewer)

irish634

Registered User.
Local time
Today, 18:48
Joined
Sep 22, 2008
Messages
230
Hi All,

Please reference the attachment. The item in particular is the image box.

I have the code so that when I double-click, I insert an image, and the image shows up via the "Me.Requery" statement.

The weird thing is when I delete the image, and try to requery the form, the image box does not refresh and the deleted image stays in the image box until I close the form and re-open it.

Any Ideas?
Thanks,
Craig

View attachment ImageTest.zip
 

WayPay

Registered User.
Local time
Today, 23:48
Joined
Nov 3, 2008
Messages
118
Be aware that the 'Kill sFile' deletes a file bypassing the recycle bin. You don't even need to delete the file.
Code:
Private Sub Form_Current()
On Error GoTo Error_Handler

    If IsNull(DLookup("[txt_CoLogo]", "tbl_CompanyInfo", "lng_RecordID=1")) Or DLookup("[txt_CoLogo]", "tbl_CompanyInfo", "lng_RecordID=1") = "" Then
[B]        Me.img_CoLogo.Picture = ""[/B]
        Exit Sub
    Else
        img_CoLogo.Picture = DLookup("[txt_CoLogo]", "tbl_CompanyInfo", "lng_RecordID=1")
    End If
    
Error_Handler_Exit:
    Exit Sub

Error_Handler:
    MsgBox Err.Number & vbCrLf & Err.Description, vbInformation, "Error"
    Err.Clear
    Resume Error_Handler_Exit
    
End Sub
The image still only gets cleared after the message 'logo has been deleted', but I'll leave it to you to fix that :D.
 

irish634

Registered User.
Local time
Today, 18:48
Joined
Sep 22, 2008
Messages
230
Be aware that the 'Kill sFile' deletes a file bypassing the recycle bin. You don't even need to delete the file.
Code:
Private Sub Form_Current()
On Error GoTo Error_Handler

    If IsNull(DLookup("[txt_CoLogo]", "tbl_CompanyInfo", "lng_RecordID=1")) Or DLookup("[txt_CoLogo]", "tbl_CompanyInfo", "lng_RecordID=1") = "" Then
[B]        Me.img_CoLogo.Picture = ""[/B]
        Exit Sub
    Else
        img_CoLogo.Picture = DLookup("[txt_CoLogo]", "tbl_CompanyInfo", "lng_RecordID=1")
    End If
    
Error_Handler_Exit:
    Exit Sub

Error_Handler:
    MsgBox Err.Number & vbCrLf & Err.Description, vbInformation, "Error"
    Err.Clear
    Resume Error_Handler_Exit
    
End Sub
The image still only gets cleared after the message 'logo has been deleted', but I'll leave it to you to fix that :D.

Thanks. Sometimes I overlook the obvious thinking it's more involved than it actually is.
As far as the "kill" yes, deleting the file is the goal. I'll probably remove it though.
 

Users who are viewing this thread

Top Bottom