Page 1 of 2 12 LastLast
Results 1 to 15 of 16
  1. #1
    kiwichick is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Feb 2020
    Posts
    31

    Moved database images don't display

    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.
    Last edited by kiwichick; 06-29-2020 at 04:53 PM. Reason: Corrected information

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,822
    Are you saving full path into field? Is old image path still in records?

    This is not a split design database?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    kiwichick is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Feb 2020
    Posts
    31
    Quote Originally Posted by June7 View Post
    Are you saving full path into field? Is old image path still in records?

    This is not a split design database?
    Thanks June7
    Yes, yes, no ☺
    Last edited by kiwichick; 06-28-2020 at 08:11 PM. Reason: Corrected information

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,822
    Forgot to ask if Images folder was also copied to new location. Do you want to reference this new folder?

    Instead of saving full file path, could just save image name and build full path with expression.
    Code:
    =CurrentProject.Path & "\" & [ImageName]
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    kiwichick is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Feb 2020
    Posts
    31
    Quote Originally Posted by June7 View Post
    Forgot to ask if Images folder was also copied to new location. Do you want to reference this new folder?

    Instead of saving full file path, could just save image name and build full path with expression.
    Code:
    =CurrentProject.Path & "\" & [ImageName]
    Thanks again. Yes the image folder was moved. It's in the same folder as the database file. Great, yes I could do that! In fact, it was something I was thinking about and now I know what code I need. But where do I use the code? For example, which control, which event? And is it likely to have any effect on what's happening with the images not displaying? ☺

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,822
    You moved folder but the old path is stored in record. Did you also delete the old folder? How would you expect code to find image?

    The example code would be in ControlSource of image control.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  7. #7
    kiwichick is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Feb 2020
    Posts
    31
    Quote Originally Posted by June7 View Post
    You moved folder but the old path is stored in record. Did you also delete the old folder? How would you expect code to find image?

    The example code would be in ControlSource of image control.
    Because the image filepath is exactly the same as it was on the other computer ☺ And, thanks, I'll add that code ☺

  8. #8
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,822
    Read your question again. What do you mean by 'background code'?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  9. #9
    kiwichick is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Feb 2020
    Posts
    31
    Quote Originally Posted by June7 View Post
    Read your question again. What do you mean by 'background code'?
    Oh geez, sorry for the confusion, I should have just said no code. So I ignore the button, remove all button code, and have nothing more than imgImage using ImagePath as the source, the images display correctly. Does that make sense?
    Last edited by kiwichick; 06-29-2020 at 03:19 PM. Reason: additional information

  10. #10
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,822
    Images display so issue is resolved?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  11. #11
    kiwichick is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Feb 2020
    Posts
    31
    Quote Originally Posted by June7 View Post
    Images display so issue is resolved?
    No it's not. I only mentioned using no code or button to point out that one works and the other doesn't. It doesn't mean I want to use the one that works just because it works. They are both completely different processes. It also doesn't explain why the other one doesn't work. Which is what my question was.

    I want to be able to use the button with the code to insert the images. I want to click the button, have filedialog open, navigate to image, select image, image path is stored, image displays. Everything works as it should but the images don't display.

    If I don't use the button and code, the images display. But then I have to manually enter the filename for the image. Which means I have to know what the image is called, rather than the other process where I just navigate and select the image.

  12. #12
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,822
    Finally tested this code.

    It works perfect for me.

    If you want to provide db for analysis, follow instructions at bottom of my post.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  13. #13
    kiwichick is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Feb 2020
    Posts
    31
    Quote Originally Posted by June7 View Post
    Finally tested this code.

    It works perfect for me.

    If you want to provide db for analysis, follow instructions at bottom of my post.
    Thanks, I'm not surprised it worked for you. It worked perfectly fine on my other system, but not this one. So here is the database file

    Plant Database.zip

  14. #14
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,822
    Your code still works. But since I don't have your images nor your folder structure, nor access to your two systems, that really doesn't mean much.

    Do images added after move work?

    Have you tried changing saved paths as I suggested? A simple Find/Replace or UPDATE action could remove the path and leave file name.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  15. #15
    kiwichick is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Feb 2020
    Posts
    31
    Quote Originally Posted by June7 View Post
    Your code still works. But since I don't have your images nor your folder structure, nor access to your two systems, that really doesn't mean much.

    Do images added after move work?

    Have you tried changing saved paths as I suggested? A simple Find/Replace or UPDATE action could remove the path and leave file name.
    OK so now I feel like I've wasted your time, and you've been so helpful. My laptop has just done some updates and now the images work fine. Geez!! So sorry, and thank you, thank you, thank you ☺

Page 1 of 2 12 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 7
    Last Post: 03-22-2020, 02:05 PM
  2. Replies: 4
    Last Post: 04-10-2019, 06:15 PM
  3. Replies: 10
    Last Post: 03-08-2018, 02:26 PM
  4. Moved Database - Now Query wont run
    By elb1999 in forum Queries
    Replies: 3
    Last Post: 07-12-2011, 10:19 AM
  5. Replies: 17
    Last Post: 08-26-2009, 11:27 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums