Hi, could someone please help me out with this 2220 error?
This is my first time dealing with image linking in a form and so far I’ve managed to link a picture object with its corresponding location in my computer folder. I’ve also figured out how to avoid the error for Invalid Use of Null in Query by setting a default value (a “noimage.jpg” file) for each new record and for every old record that was left empty.
The problem is that I need to use the database on other computers where the picture directories either don’t exist or are not the same. I don’t really need the form’s picture object to work there. All I’m trying to do is find out a way to stop ‘’the run-time error 2220’’ from showing every time I open the form or go from one record to another.
I’ve tried a line of code in the form’s On Error property: If Err.Number = 2220 Then Stop - but that didn’t work.
I also tried the following code:
Private Sub Form_Current()
If Dir("C:\Users\Katt\Desktop\animalspics\" & Me!picaddress) = " " Then
picview.Picture = "C:\Users\Katt\Desktop\animalspics\noimage.jpg"
Else
picview.Picture = "C:\Users\Katt\Desktop\animalspics\" & Me!picaddress
End If
End Sub
(where “picaddress” is the text box that stores the picture file directory, and “picview” is the picture object of the form). This also didn’t work. Have I got the code wrong or is there any other way to deal with this 2220 error?
As an access newbie I’d appreciate any comment!
This is my first time dealing with image linking in a form and so far I’ve managed to link a picture object with its corresponding location in my computer folder. I’ve also figured out how to avoid the error for Invalid Use of Null in Query by setting a default value (a “noimage.jpg” file) for each new record and for every old record that was left empty.
The problem is that I need to use the database on other computers where the picture directories either don’t exist or are not the same. I don’t really need the form’s picture object to work there. All I’m trying to do is find out a way to stop ‘’the run-time error 2220’’ from showing every time I open the form or go from one record to another.
I’ve tried a line of code in the form’s On Error property: If Err.Number = 2220 Then Stop - but that didn’t work.
I also tried the following code:
Private Sub Form_Current()
If Dir("C:\Users\Katt\Desktop\animalspics\" & Me!picaddress) = " " Then
picview.Picture = "C:\Users\Katt\Desktop\animalspics\noimage.jpg"
Else
picview.Picture = "C:\Users\Katt\Desktop\animalspics\" & Me!picaddress
End If
End Sub
(where “picaddress” is the text box that stores the picture file directory, and “picview” is the picture object of the form). This also didn’t work. Have I got the code wrong or is there any other way to deal with this 2220 error?
As an access newbie I’d appreciate any comment!