Time to post a db copy.
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.
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!
form open code
resultCode:Private Sub Form_Open(Cancel As Integer) Me.Image8.Picture = "C:\Users\Micron\ConstRenoWworking\WoodWorking\Megans\20171122_160059b.jpg" End Sub
button click code
ResultCode:Private Sub Command9_Click() Dim strPath As String strPath = "C:\Users\Micron\Pictures\Saved Pictures\DSC_1036.JPG" Me.Image8.Picture = strPath End Sub
The more we hear silence, the more we begin to think about our value in this universe.
Paraphrase of Professor Brian Cox.
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
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.
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.
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.
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.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
I've re-created the DefaultPic.jpg file and all works as would be expected.
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