There are a couple of issues with your code.
(see bottom of the code)
Code:
Private Sub cmdAddImage_Click()
Me.Imageframe.Visible = True
On Error GoTo cmdAddImage_Err
Dim strFilter As String
Dim lngflags As Long
Dim varFileName As Variant
strFilter = "All Files (*.*)" & vbNullChar & "*.*" _
& vbNullChar & "All Files (*.*)" & vbNullChar & "*.*"
lngflags = tscFNPathMustExist Or tscFNFileMustExist _
Or tscFNHideReadOnly
varFileName = tsGetFileFromUser( _
fOpenFile:=True, _
strFilter:=strFilter, _
rlngflags:=lngflags, _
strDialogTitle:="Please choose a file...")
If IsNull(varFileName) Then
Else
Me![imagepath] = varFileName
Me.Recalc
Dim strBookmark As String
strBookmark = Me.ID
Me.Requery
DoCmd.FindRecord strBookmark, , True, , True
End If
cmdAddImage_End:
On Error GoTo 0
Exit Sub
cmdAddImage_Err:
Beep
MsgBox Err.Description, , "Error: " & Err.Number _
& " in file"
Resume cmdAddImage_End '<<-- jump to cmdAddImage_End:
-----------------------------------------------------------------
'------ The code below here will NEVER be executed --------------
'------ because it is in the error handler code "cmdAddImage_Err:"
If Me.imagepath Is Null Then '<<-- should be IsNull(Me.imagepath)
Me.Imageframe.Visible = False
End If
If Not IsNull(Me.imagepath) Then
Me.Imageframe.Visible = True
Me.Imageframe.Requery
End If
End Sub
I kludged together a form and image control and modified your code (I don't have "tsGetFileFromUser" or the flags).
But every time I changed the image manually, the image control updated immediately. (But I don't know what control you are using for image display)
Research: Me.Refresh and Me.Repaint
I suggest using Me.Refresh instead of Me.Requery.
Maybe you could/would make a copy of the dB with just a few records (change any sensitive data) for analysis??