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

sdzc

Registered User.
Local time
Yesterday, 22:41
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!
 

boblarson

Smeghead
Local time
Yesterday, 20:41
Joined
Jan 12, 2001
Messages
32,059
How about this:

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

sdzc

Registered User.
Local time
Yesterday, 22:41
Joined
Mar 27, 2004
Messages
46
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.
 

boblarson

Smeghead
Local time
Yesterday, 20:41
Joined
Jan 12, 2001
Messages
32,059
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
 

sdzc

Registered User.
Local time
Yesterday, 22:41
Joined
Mar 27, 2004
Messages
46
Again, that worked!!

Thank you so much!!
 

boblarson

Smeghead
Local time
Yesterday, 20:41
Joined
Jan 12, 2001
Messages
32,059
 

sdzc

Registered User.
Local time
Yesterday, 22:41
Joined
Mar 27, 2004
Messages
46
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
 

sdzc

Registered User.
Local time
Yesterday, 22:41
Joined
Mar 27, 2004
Messages
46
Just a bump, hoping for an answer

Just a bump, hoping for an answer to my last post.
 

sdzc

Registered User.
Local time
Yesterday, 22:41
Joined
Mar 27, 2004
Messages
46
Bob!! One last question..

Last attempt at a answer.
 

boblarson

Smeghead
Local time
Yesterday, 20:41
Joined
Jan 12, 2001
Messages
32,059
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

Top Bottom