A Microsoft Office (Excel, Word) forum. OfficeFrustration

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.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Linked image not displayed on form



 
 
Thread Tools Display Modes
  #1  
Old April 16th, 2008, 01:07 AM posted to microsoft.public.access.forms
[email protected][_2_]
external usenet poster
 
Posts: 12
Default 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  
Old April 16th, 2008, 09:34 PM posted to microsoft.public.access.forms
Carl Rapson
external usenet poster
 
Posts: 517
Default 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  
Old April 18th, 2008, 06:54 PM posted to microsoft.public.access.forms
[email protected][_2_]
external usenet poster
 
Posts: 12
Default 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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 10:49 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.