Thanks for the quick reply. I think you had intentions of puting some code
in this email? I am still in need of a solution to have the picture change
when I change the contact or just show a blank if no picture is on file. Any
help would be great. Thank you.
> Yes that can be done quite easily.
> Use the "Image" tool that can be found on the toolbar...
[quoted text clipped - 29 lines]
>> TY
>> Eric
In the form's "Current" event
Place the following code (This is assuming you have placed the image holder
and named it something like ContactPic - oh and also assuming you have a
ContactDetail form with all their information that you want to relate this to)
Private Sub Form_Current
dim PathToPhoto as string
dim ContactPhoto as string
PathToPhoto = "D:\MyContactPhotos....wherever your path is"
ConactPhoto = Me.ContactID & ".jpg"
'(try to be consistent in whatever format you decide)
If len(PathToPhoto & "\" & Me.ContactID & ".jpg") <> 0 then
ContactPic.Picture = ContactPhoto
Else
ContactPic.Picture = ""
'(Or you could have a picture of your company logo here "CompanyLogo.jpg")
End If
This process will make it so all you have to do, is acquire that photo from
your contact, and put it in the folder named ContactID.jpg (for each
different Contact)
Example 434.jpg, 435.jpg etc..
When you delete their photo, the program will automatically display the
CompanyLogo.jpg
This can be tweaked a little more, but should suffice.
When you test it after you have acquired at least 2 or 3 photos, try moving
through each contact record - You will notice the contacts picture changing
for each contact if you PageDown or click your 'Next' button through your
Details form.
> Thanks for the quick reply. I think you had intentions of puting some code
> in this email? I am still in need of a solution to have the picture change
[quoted text clipped - 34 lines]
> >> TY
> >> Eric
Eric F - 11 Dec 2005 00:37 GMT
This works great...Thanks. The only problem I am having is I get an error if
I don't have a pic for all the contacts. Is there some code I can put in to
show nothing is a contact has no pic?
> In the form's "Current" event
>
[quoted text clipped - 80 lines]
>> >> TY
>> >> Eric
Eric F - 11 Dec 2005 00:37 GMT
This works great...Thanks. The only problem I am having is I get an error if
I don't have a pic for all the contacts. Is there some code I can put in to
show nothing is a contact has no pic?
> In the form's "Current" event
>
[quoted text clipped - 80 lines]
>> >> TY
>> >> Eric
jonefer - 11 Dec 2005 08:43 GMT
Try the following...
Create a picture called "Blank.jpg" with your favorite photo editor
(photoshop etc.)
For the "else" portion of the IF statement. It could be plain gray, white,
or a company logo.
I'm figuring this should be enough to prevent an error, but
I even added error handling just in case -
(look at the error number you receive when you get this error and use it
below)
Then use the following, in your current event:
Private Sub Form_Current
On Error GoTo EH
If len(PathToPhoto & "\" & Me.ContactID & ".jpg") <> 0 then
ContactPic.Picture = ContactPhoto
Else
ContactPic.Picture = PathToPhoto & "\" & "Blank.jpg"
End If
Exit Sub
EH:
Select Case Err
case 52,62 '(or whatever number you see)
ContactPic.Picture = PathToPhoto & "\" & "Blank.jpg"
msgbox "No picture available"
end select
End Sub
Just keep playing around with this.. you'll get it soon.
> This works great...Thanks. The only problem I am having is I get an error if
> I don't have a pic for all the contacts. Is there some code I can put in to
[quoted text clipped - 84 lines]
> >> >> TY
> >> >> Eric
Eric F - 12 Dec 2005 16:22 GMT
Good morning,
I first want to thank you for helping me on this. It is almost working 100%.
I have one more issue... Upon opening the project the pictures will not
display, almost like it has lost connection with the path. The pictures are
contained on a network drive. If I go into the properties of the picture box
and click on the picture path it will work. But of course doesnt when I have
closed and reopened the DB. Below is the code I am using.
Private Sub Form_Current()
On Error GoTo Err_NoPic
Dim PathToPhoto As String
Dim ContactPhoto As String
PathToPhoto = "I:\NAIOP_Website\images\Members"
ContactPhoto = Me.ContactID & ".jpg"
If Len(PathToPhoto & "\" & Me.ContactID & ".jpg") <> 0 Then
ContactPic.Picture = ContactPhoto
Else
ContactPic.Picture = "I:\NAIOP_Website\images\Members\nopic.jpg"
End If
Err_NoPic:
Select Case Err
Case 2220
ContactPic.Picture = "I:\NAIOP_Website\images\Members\nopic.jpg"
End Select
End Sub
> Try the following...
> Create a picture called "Blank.jpg" with your favorite photo editor
[quoted text clipped - 128 lines]
>> >> >> TY
>> >> >> Eric
jonefer - 12 Dec 2005 17:52 GMT
Good morning. You caught me on the way to work. I'm glad it's almost 100%
My application is similar, but when I answered your questions, I tried to
improve on my design.
Just curious. After you open, if you move to the next record does a picture
display?
If so, try one more thing and if that doesn't work, I'll see if I can look
at it tonight.
in your "Load" event put the following line:
call form_current
This will call the same code when the form loads.
and the current event will take over for every subsequent record you look at.
(I noticed that I did this in my application, but I thought it was redundant
)- I assumed the current event takes place in the Load Event as well. So try
this... again if it doesn't work, I'll help you until it does!
> Good morning,
>
[quoted text clipped - 157 lines]
> >> >> >> TY
> >> >> >> Eric
Eric F - 12 Dec 2005 20:34 GMT
This may also shed some light on the problem. I can see an error box flash
and clearly there is a nopic.jpg in the spot. So I know it is calling the
right path. Problem must lie in the link from the Picture box. I have tried
leaving the pic box link to (none) and also with the path to no avail.
Thanks again.
> Good morning. You caught me on the way to work. I'm glad it's almost 100%
> My application is similar, but when I answered your questions, I tried to
[quoted text clipped - 199 lines]
>> >> >> >> TY
>> >> >> >> Eric