I've never used the shared or linked property of an image control . It appears that the image is saved in a deep table somewhere.
Possibly numerous times. You'd probably need to access that table to delete the photo.
Although I don't recommend attachment fields if you use one you can display the photo using the ImageAttached.FileData field and ImageAttached.FileName field to test if there's an image.
I've never used the shared or linked property of an image control . It appears that the image is saved in a deep table somewhere.
Possibly numerous times. You'd probably need to access that table to delete the photo.
Although I don't recommend attachment fields if you use one you can display the photo using the ImageAttached.FileData field and ImageAttached.FileName field to test if there's an image.
Finally!
I found a very practical solution and I will share it with you:
Create two picture boxes with the same size (height and width) and the following property settings: Box 1:
Name: PhotoClient
Visible: Yes
Image Type: Shared
Image: (none)
Size Mode: Zoom
Image Alignment: Centered
Box 2:
Name: NoImage
Visible: No
Image Type: Shared
Image: *ADD ANY BLANK IMAGE HERE*
Size Mode: Zoom
Image Alignment: Centered Note: Place this control on the same form as the other image control, in an out-of-the-way place.
Create two command buttons with the following property settings and place them just below the "PhotoClient" image box: Button 1:
Name: ButtonAddChangePhoto
Button 2:
Name: ButtonDeletePhoto
======================================================
In the OnClick event of the ButtonAddChangePhoto button, enter this code:
Code:
Dim SearchPhoto As Office.FileDialog
Set SearchPhoto = Application.FileDialog(msoFileDialogFilePicker)
With Photo Search
.AllowMultiSelect = False
.Title = "Select the photo..."
.Filters.Clear
.Filters.Add "Customer Photo", "*.jpg; *.jpeg; *.png"
If .Show = True Then
Me.PhotoClient.Picture = .SelectedItems(1)
Else
MsgBox "No photo selected!", vbInformation, "INFORMATION"
End if
end with
Set SearchPhoto = Nothing
======================================================
In the OnClick event of the ButtonDeletePhoto button, enter this code:
Code:
If Me.PhotoClient.Picture <> Me.NoImage.Picture Then
Me.PhotoClient.Picture = Me.NoImage.Picture
MsgBox "Photo Deleted Successfully!", vbInformation, "INFORMATION"
Else
MsgBox "There are no photos to delete!", vbInformation, "INFORMATION"
End if
I sincerely thank all of you for participating in this saga!
Thanks!