I have an Access 2016 database that I created on a system running Windows 10. I've copied it to another system also running Windows 10. So far everything on the form seems to work fine but the images that were added for each record don't display. I have a command button (name btnAddImage) to open FileDialog so that, for each record, I can select an image, store the image's filepath in a table (field name ImagePath) and display the image in an image control (name imgImage). The following may help pinpoint the problem but I'll gladly provide any other info required:
. I've tried adding the image again but when I click the button, even though everything happens as it should, the image doesn't display.
. I have an ImagePath text box control on the form and I can see it populate/change the filepath when an image is selected/changed. And I can see it clear when I use the command button I have to delete the image.
. On the Property Sheet imgImage/Data/Control Source is set to ImagePath.
. The Add Image button On Click event contains the following code:
Code:
Private Sub btnAddImage_Click()
Dim strPath As String
On Error GoTo ErrHandler
With Application.FileDialog(1)
.Filters.Clear
.Filters.Add "Image Files", "*.bmp;*.gif;*.jpg;*.png"
.InitialFileName = CurrentProject.Path & "\Images\"
If .Show Then
Me.ImagePath = .SelectedItems(1)
Me.imgImage.Requery
End If
End With
Exit Sub
ErrHandler:
MsgBox Err.Description, vbExclamation
End Sub
. If I don't use the button and code, and just have imgImage with source as ImagePath, the image displays. As soon as I add the button and code, no image.
. Setting up an OnClick event for the image control to display a MsgBox with the image path displays the correct path so it knows what should be there.
I can't help wondering if there's a setting somewhere I'm meant to set. Maybe there's something I need to install on my system. Or maybe the device (a 2013 Acer P3-131 dual touchscreen laptop/tablet) has some kind of incompatibility issue. Any help is greatly appreciated, thanks.