Trying to show a picture on a form (partially successful)

sdzc

Registered User.
Local time
Today, 08:02
Joined
Mar 27, 2004
Messages
46
I am trying to show a picture on a form and I have it showing when there is a path in the field, but when I move to a record with no picture path in the text field it is drawing from, I get the debug error (Invalid use of Null).

I am using the following code:

Private Sub Form_Current()
Me.ImgPic.Picture = Me!txtpicture1
End Sub


It appears it is not handling the "null" of an empty field, but I cannot figure out how to get it to ignore a null field.

Thanks for any help!
 
How about this:

Code:
Private Sub Form_Current()
If Len(NZ(Me!txtpicture) & "")>0 Then
   Me.ImgPic.Picture = Me!txtpicture1
End If
End Sub
 
That worked, thank you!!

I did notice, however, that the picture stays in the frame even when you move off that record to a record in which there is no picture path. Is there a way to get the frame (picture) to go blank when there is no path in the field?

Hope this makes sense.
 
That worked, thank you!!

I did notice, however, that the picture stays in the frame even when you move off that record to a record in which there is no picture path. Is there a way to get the frame (picture) to go blank when there is no path in the field?

Hope this makes sense.

How about this:

Code:
Private Sub Form_Current()
If Len(NZ(Me!txtpicture) & "")>0 Then
   Me.ImgPic.Picture = Me!txtpicture1
Else
   Me.ImgPic.Picture = ""
End If
End Sub
 
Again, that worked!!

Thank you so much!!
 
GladWeCouldHelp.png
 
Bob (or anyone else):

Another question has come up.

When we move too quickly from record to record, the database will "crash" and want to do a recovery. I believe this is because the pictures are not given enough time to load while moving between records.

Anything we can do to keep this from happening (other than slowing down between records)?

Thanks again
 
Just a bump, hoping for an answer

Just a bump, hoping for an answer to my last post.
 
Bob!! One last question..

Last attempt at a answer.
 
Just a thought - Get rid of the native navigation buttons and put in your own so then you can enable and disable when you want. So use a timer to wait for a certain interval in order to give it time to load and then re-enable the nav buttons. Just a thought.
 

Users who are viewing this thread

Back
Top Bottom