If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Linked image not displayed on form
I am running Access 2003.
Thanks to one of John Viescas' books, I've been able to add and display an image on a form. Unfortunately, as soon as I move to a new record in the form, then go back to the first record, the first record's image is no longer displayed. Thank you for any help. DJohnson Here is my code to display the image: Private Sub Form_Current() Dim strPath As String If Me.NewRecord Then Me.lblMsg.Caption = "Click Add to insert a photo of this volunteer." Me.lblMsg.Visible = True Me.imgVolunteer.Visible = False Exit Sub End If On Error Resume Next If IsNull(Me.Photo) Then Me.lblMsg.Caption = "Click Add to insert a photo of this volunteer." Me.lblMsg.Visible = True Me.imgVolunteer.Visible = False Else strPath = Me.txtPhoto If (InStr(strPath, ":") = 0) And (InStr(strPath, "\\") = 0) Then strPath = CurrentProject.Path & "\" & strPath End If Me.imgVolunteer.Picture = strPath If Err 0 Then Me.lblMsg.Caption = "Photo not found. Click Add to correct." Me.lblMsg.Visible = True Me.imgVolunteer.Visible = False Else Me.imgVolunteer.Visible = True Me.PaintPalette = Me.imgVolunteer.ObjectPalette End If End If End Sub |
#2
|
|||
|
|||
Linked image not displayed on form
wrote in message
... I am running Access 2003. Thanks to one of John Viescas' books, I've been able to add and display an image on a form. Unfortunately, as soon as I move to a new record in the form, then go back to the first record, the first record's image is no longer displayed. Thank you for any help. DJohnson Here is my code to display the image: Private Sub Form_Current() Dim strPath As String If Me.NewRecord Then Me.lblMsg.Caption = "Click Add to insert a photo of this volunteer." Me.lblMsg.Visible = True Me.imgVolunteer.Visible = False Exit Sub End If On Error Resume Next If IsNull(Me.Photo) Then Me.lblMsg.Caption = "Click Add to insert a photo of this volunteer." Me.lblMsg.Visible = True Me.imgVolunteer.Visible = False Else strPath = Me.txtPhoto If (InStr(strPath, ":") = 0) And (InStr(strPath, "\\") = 0) Then strPath = CurrentProject.Path & "\" & strPath End If Me.imgVolunteer.Picture = strPath If Err 0 Then Me.lblMsg.Caption = "Photo not found. Click Add to correct." Me.lblMsg.Visible = True Me.imgVolunteer.Visible = False Else Me.imgVolunteer.Visible = True Me.PaintPalette = Me.imgVolunteer.ObjectPalette End If End If End Sub Try putting a breakpoint on the first executable statement in Form_Current and step through the code to see just what's happening and where any error might be occurring. Carl Rapson |
#3
|
|||
|
|||
Linked image not displayed on form
On Apr 16, 1:34*pm, "Carl Rapson"
wrote: wrote in message ... I am running Access 2003. Thanks to one of John Viescas' books, I've been able to add and display an image on a form. Unfortunately, as soon as I move to a new record in the form, then go back to the first record, the first record's image is no longer displayed. Thank you for any help. DJohnson Here is my code to display the image: Private Sub Form_Current() Dim strPath As String * *If Me.NewRecord Then * * * *Me.lblMsg.Caption = "Click Add to insert a photo of this volunteer." * * * *Me.lblMsg.Visible = True * * * *Me.imgVolunteer.Visible = False * * * *Exit Sub * *End If * *On Error Resume Next * *If IsNull(Me.Photo) Then * * * *Me.lblMsg.Caption = "Click Add to insert a photo of this volunteer." * * * *Me.lblMsg.Visible = True * * * *Me.imgVolunteer.Visible = False * *Else * * * *strPath = Me.txtPhoto * * * *If (InStr(strPath, ":") = 0) And (InStr(strPath, "\\") = 0) Then * * * * * *strPath = CurrentProject.Path & "\" & strPath * * * *End If * * * *Me.imgVolunteer.Picture = strPath * * * *If Err 0 Then * * * * * *Me.lblMsg.Caption = "Photo not found. Click Add to correct." * * * * * *Me.lblMsg.Visible = True * * * * * *Me.imgVolunteer.Visible = False * * * *Else * * * * * *Me.imgVolunteer.Visible = True * * * * * *Me.PaintPalette = Me.imgVolunteer.ObjectPalette * * * *End If * *End If End Sub Try putting a breakpoint on the first executable statement in Form_Current and step through the code to see just what's happening and where any error might be occurring. Carl Rapson- Hide quoted text - - Show quoted text - Thank you for your response. |
Thread Tools | |
Display Modes | |
|
|