Page 2 of 2 FirstFirst 12
Results 16 to 23 of 23
  1. #16
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,737
    Time to post a db copy.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  2. #17
    GraeagleBill's Avatar
    GraeagleBill is offline Experienced Old Geezer
    Windows 10 Access 2013 32bit
    Join Date
    Feb 2011
    Posts
    1,919
    In pursuing the thought that I could possibly have a corrupted form, I created a new form with a single image control and attempted to set the picture property in the form's OnOpen and I still get the 2220. I have a few more apps that do the same thing without any problems, so I'm baffled as to what might be different with this app. I'll try a new DB and new form next............... SIGH!

  3. #18
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,737
    form open code
    Code:
    Private Sub Form_Open(Cancel As Integer)
    Me.Image8.Picture = "C:\Users\Micron\ConstRenoWworking\WoodWorking\Megans\20171122_160059b.jpg"
    End Sub
    result
    Click image for larger version. 

Name:	swap1.jpg 
Views:	18 
Size:	9.7 KB 
ID:	44326

    button click code
    Code:
    Private Sub Command9_Click()
    Dim strPath As String
    strPath = "C:\Users\Micron\Pictures\Saved Pictures\DSC_1036.JPG"
    Me.Image8.Picture = strPath
    End Sub
    Result
    Click image for larger version. 

Name:	swap2.jpg 
Views:	18 
Size:	9.9 KB 
ID:	44327
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  4. #19
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,861
    As I mentioned, I have it working now, despite getting the same errors as yourself originally.?

    The problem is I am not sure what I did to get it to work?

    I used Windows Explorer to get the actual path, and as I mentioned before the only difference I could see was the correct case?
    However I then changed C: to c: as you have it and it still worked?

    I could not believe any case would cause this (not Linux after all? ), so all I can say is what you are trying to do does work
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  5. #20
    GraeagleBill's Avatar
    GraeagleBill is offline Experienced Old Geezer
    Windows 10 Access 2013 32bit
    Join Date
    Feb 2011
    Posts
    1,919
    I'm stumped! New DB with single form with single image control with attempts to change the Picture property in the OnOpen gets me a 2220 error. New DB coping all elements (forms, tables, etc) from failing DB also fails. Two other apps I have that have image controls with both OnOpen AND dynamic picture changes work perfectly. Attempts to change Picture property with command button also fail.

  6. #21
    GraeagleBill's Avatar
    GraeagleBill is offline Experienced Old Geezer
    Windows 10 Access 2013 32bit
    Join Date
    Feb 2011
    Posts
    1,919
    I'm stumped! New DB with single form with single image control with attempts to change the Picture property in the OnOpen gets me a 2220 error. New DB coping all elements (forms, tables, etc) from failing DB also fails. Two other apps I have that have image controls with both OnOpen AND dynamic picture changes work perfectly. Attempts to change Picture property with command button also fail.

  7. #22
    GraeagleBill's Avatar
    GraeagleBill is offline Experienced Old Geezer
    Windows 10 Access 2013 32bit
    Join Date
    Feb 2011
    Posts
    1,919
    I FOUND THE PROBLEM............. be back with a post in a bit

    With the assumption that I/we would ultimately find the problem with the 2220, I decided to proceed with the form development, which includes the "AfterUpdate" event code for the textbox control the user uses to change the image. The DefaultPic Link path is still set in the image control's property sheet, but no attempts to change anything in the OnOpen event. So, the form opens to the user with the DefaultPic being displayed.
    Code:
    Private Sub tbImgName_AfterUpdate()
    '*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*
    '  User needs/wants to change the image corresponding to other record updates.  Make
    '  sure it exists and proceed accordingly.
    '*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*
    Dim strImageName As String
    
    strImageName = ImagePath & "\" & tbImgName & ".jpg"
    If Len(Dir(strImageName)) > 0 Then
        Me.imgFormImage.Picture = strImageName
    Else
        MsgBox strImageName & " not found in folder " & ImagePath
        Me.tbImgName = Me.tbImgName.OldValue
    End If
    
    End Sub
    Using the form's textbox to change the image via the above code works perfectly with other jpg image files. BUT, if I attempt to return to the DefaultPic the DIR function is unable to find the file, as reported by the MsgBox one sees in the event code. So, I'm left with the conclusion that the problem is a directory issue that Access has stumbled upon. I can and have several time access the DefaultPic.jpg file with Windows Explorer.

    I've re-created the DefaultPic.jpg file and all works as would be expected.

  8. #23
    GraeagleBill's Avatar
    GraeagleBill is offline Experienced Old Geezer
    Windows 10 Access 2013 32bit
    Join Date
    Feb 2011
    Posts
    1,919
    BTW, Thanks to all of you that gave your time trying to help solve this issue. It's not too often in my experience that corruption issues such as this appears to be turn out to be the root.
    Bill

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

Similar Threads

  1. Replies: 6
    Last Post: 09-18-2020, 09:06 PM
  2. Replies: 5
    Last Post: 07-10-2020, 12:41 PM
  3. Replies: 3
    Last Post: 07-13-2015, 12:07 PM
  4. Printing form: image fails to update
    By stellar0645 in forum Forms
    Replies: 6
    Last Post: 02-04-2010, 11:41 AM
  5. Image control in MS Access
    By celestialcitizen in forum Forms
    Replies: 6
    Last Post: 07-03-2009, 03:25 PM

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