Linked Image

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Good morning,

I have a linked image on a form. However, I am not working on my work
network and as such keep getting error about the db not being able to open
'Image path'. is there a way to trap this error? i have tried using the
Load event of the form but it didn't catch this error?!

Thank you for your help,

Daniel
 
Hi Daniel,

You have two choices:

i) Make a copy of the database, in the copy delete the references to
the stuff at work, then copy and paste all the items you have updated
in to the 'work' copy.

ii) You could also write and error handler that told the code to carry
on uninterupted if that error occurs.

I prefer the second option myself.

Good luck,
 
ii) this is what I am trying to do but the error doesn't seem to get raised
by any events that I've used. I've tried Activate, Open, Load... none seem
to trap the eeror being generated? Any ideas?

Thanks,

Daniel
 
Daniel said:
Good morning,

I have a linked image on a form. However, I am not working on my work
network and as such keep getting error about the db not being able to open
'Image path'. is there a way to trap this error? i have tried using the
Load event of the form but it didn't catch this error?!

Thank you for your help,

Daniel

Sorry, I'm writing this and then searching, so my answer is backwards.
(Watch Memento a few times and hopefully this post will be easier to
understand...)

Okay, I found it. I _knew_ it had to be there!!!
http://vbnet.mvps.org/code/network/isnetworkalive.htm

So you'd have the code from Randy's site to tell you if the network you
need to connect to is available. Then I suppose you could do something
like

IF IsNetConnectionAlive() Then
strImagePath="\\Servername\directory\subdirectory\image.jpg"
Else
strImagePath=App.Path & "\" & "offnetwork.jpg"
End If

Gross simplification, I'm sure, but the general idea is to check the
network connection before you open all your forms and have them respond
appropriately. If IsNetworkAlive is False, then just load images from
a local directory or set the path to the images to a different place.
(Basically deal with the error gracefully instead of making the user
wonder what's going on.)

Hope this helps a little bit.

Pieter
 
If you’re using an Image Control, check that the images are accessible before assigning the path:

If Len(Dir(ImagePath)) > 0 Then
Image1.Picture = ImagePath
Else
Image1.Picture = ""
End If
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top