Problem with images display on form

Mansoor Ahmad

Registered User.
Local time
Today, 12:04
Joined
Jan 20, 2003
Messages
140
Dear All

I am using the following objects on the form to display images;

One text box that holds image paths (txtimagepath)
An unbound object frame (myimagebox1)

Following is the code being used:

Private Sub Form_Current()
On Error Resume Next
If Not IsNull(Me![txtimagepath]) Then
Me![myimagebox1].OLETypeAllowed = 1
Me![myimagebox1].SourceDoc = Me![txtimagepath]
Me![myimagebox1].Action = 0
End If
End Sub


Private Sub txtimagepath_AfterUpdate()
On Error Resume Next
Me![myimagebox1].OLETypeAllowed = 1
Me![myimagebox1].SourceDoc = Me![txtimagepath]
Me![myimagebox1].Action = 0
End Sub

Now it works fine when image path is available. But when there is no image path in text box, the unbound object frame still displays the last image. When navigating the records it will keep on showing that one image for all next records till there is another image path available.

How can this be solved so that it only shows the image for that record where the image path is mentioned.

Thanks
 
Was a solution ever identified for this? I've the same exact problem now!!
 
use an unbound image control for your image, and then put the following in the after update event of your path textbox:

Code:
Private Sub Form_Current()
On Error GoTo Err_Form_Current
If Not IsNull(Me.txtImagePath) Then
Me.myimagebox1.Picture = txtImagePath
Else
Me.myimagebox1.Picture = "I put path for an alternative not available image"
End If
Exit_Err_Form_Current:
Exit Sub
Err_Form_Current:
If Err.Number = 2220 Then
Me.myimagebox1.Picture = "I put path for an alternative not available image"
Else
MsgBox Err.Description, vbExclamation, "Error #" & Err.Number
End If
End Sub
 

Users who are viewing this thread

Back
Top Bottom