View Images on Form

G

Guest

Hello,

I currently have a form that contains a field that hyperlinks to a picture
file on my computer (jpeg and/or bmp). I do not want to store the actual
picture in my database, using a bound object, as it will make the database
huge. I have placed a web browser on my form and I would like to have it
display the picture located in the hyperlink. I have used the code below,
but I get an error stating that the file cannot be opened. I can open the
picture in IE7, but not in the web browser on the form. I would really like
to be able to view my pictures on the form, without using a bound
object...and without going through the steps to convert them to html files.
Also, I really want to avoid having to click the link to have another program
open. I'd like to go record to record and have the images there, without
bogging down the database. I have had success using the web browser with htm
files saved from word and excel. Is it possible to have an image show up in
the web browser? Any suggestions would be greatly appreciated.

Thank you

Web Browser Code:

Private Sub Form_Current()
'Navigate to the current record's Web site
'If there's no URL stored in the field, then display Google search engine.

If Len([Image]) > 0 Then
ImageBrowser.Navigate URL:=[Gel]
Else
ImageBrowser.Navigate URL:="www.msn.com"
End If

End Sub
 
R

Rob Parker

You can use an Image control to display pictures on your form (in much the
same way as you are trying to use a web browser control.

If your picture field has the full path/filename for the picture, you can
use something as simple as this, in the form's Current event, to display the
picture in the image control:

If Not IsNull(Me.NameOfPhotoField) Then
Me.NameOfImageControl.Picture = Me.NameOfImagePathField
Me.NameOfImageControl.Visible = True
Else
'hide image control if no picture
Me.NameOfImageFrameControl.Visible = False
End If

To prevent Acces from crashing when scrolling rapidly through records
containing images, you need to modify some registry keys. The details are
available at
http://www.mvps.org/access/downloads/Set_ShowProgressDialog_To_No.reg

The easy way to incorporate these is this: Cut/paste to a text file (I used
Notepad), and save as a .reg file. Then all you need do is double-click the
file, or right-click and choose "Merge", to merge the entries into your
registry. For a 19kb file of entries, that's certainly faster than
entering them all manually ;-) Note: there are more entries here than are
actually needed to solve the problem, but it's so easy to import the lot
that it's not worth figuring out exactly which ones you need.

HTH,

Rob
 
G

Guest

Rob,

Thank you for the information. I added an image control to the form and
used the code you sent me. When the form opens the field is not visible, as
expected, since there is not link in the image field. However, when there is
a link present I get an error stating that it cannot jump to "image" and/or
"imagebrowser" because it is in the library (my database file name) which is
not currently referenced. Do you know what may be causing this error?

I put the following code in the oncurrent field of my form:

If Not IsNull(Me.Image) Then
Me.ImageBrowser.Picture = Me.Image
Me.ImageBrowser.Visible = True
Else
'hide image control if no picture
Me.ImageBrowser.Visible = False
End If

Where image is the hyperlink and imagebrowser is the image control.

Thank you

Rob Parker said:
You can use an Image control to display pictures on your form (in much the
same way as you are trying to use a web browser control.

If your picture field has the full path/filename for the picture, you can
use something as simple as this, in the form's Current event, to display the
picture in the image control:

If Not IsNull(Me.NameOfPhotoField) Then
Me.NameOfImageControl.Picture = Me.NameOfImagePathField
Me.NameOfImageControl.Visible = True
Else
'hide image control if no picture
Me.NameOfImageFrameControl.Visible = False
End If

To prevent Acces from crashing when scrolling rapidly through records
containing images, you need to modify some registry keys. The details are
available at
http://www.mvps.org/access/downloads/Set_ShowProgressDialog_To_No.reg

The easy way to incorporate these is this: Cut/paste to a text file (I used
Notepad), and save as a .reg file. Then all you need do is double-click the
file, or right-click and choose "Merge", to merge the entries into your
registry. For a 19kb file of entries, that's certainly faster than
entering them all manually ;-) Note: there are more entries here than are
actually needed to solve the problem, but it's so easy to import the lot
that it's not worth figuring out exactly which ones you need.

HTH,

Rob


accessuser1308 said:
Hello,

I currently have a form that contains a field that hyperlinks to a picture
file on my computer (jpeg and/or bmp). I do not want to store the actual
picture in my database, using a bound object, as it will make the database
huge. I have placed a web browser on my form and I would like to have it
display the picture located in the hyperlink. I have used the code below,
but I get an error stating that the file cannot be opened. I can open the
picture in IE7, but not in the web browser on the form. I would really
like
to be able to view my pictures on the form, without using a bound
object...and without going through the steps to convert them to html
files.
Also, I really want to avoid having to click the link to have another
program
open. I'd like to go record to record and have the images there, without
bogging down the database. I have had success using the web browser with
htm
files saved from word and excel. Is it possible to have an image show up
in
the web browser? Any suggestions would be greatly appreciated.

Thank you

Web Browser Code:

Private Sub Form_Current()
'Navigate to the current record's Web site
'If there's no URL stored in the field, then display Google search engine.

If Len([Image]) > 0 Then
ImageBrowser.Navigate URL:=[Gel]
Else
ImageBrowser.Navigate URL:="www.msn.com"
End If

End Sub
 
G

Guest

Please disregard my last post...I got rid of that error. Now when I go to a
record in which there is a link (for a picture) I get an error message
stating that it cannot open the file. Do you know what might be causing
this. The entire path to the file is displayed in the "link" field.

Thank you

Rob Parker said:
You can use an Image control to display pictures on your form (in much the
same way as you are trying to use a web browser control.

If your picture field has the full path/filename for the picture, you can
use something as simple as this, in the form's Current event, to display the
picture in the image control:

If Not IsNull(Me.NameOfPhotoField) Then
Me.NameOfImageControl.Picture = Me.NameOfImagePathField
Me.NameOfImageControl.Visible = True
Else
'hide image control if no picture
Me.NameOfImageFrameControl.Visible = False
End If

To prevent Acces from crashing when scrolling rapidly through records
containing images, you need to modify some registry keys. The details are
available at
http://www.mvps.org/access/downloads/Set_ShowProgressDialog_To_No.reg

The easy way to incorporate these is this: Cut/paste to a text file (I used
Notepad), and save as a .reg file. Then all you need do is double-click the
file, or right-click and choose "Merge", to merge the entries into your
registry. For a 19kb file of entries, that's certainly faster than
entering them all manually ;-) Note: there are more entries here than are
actually needed to solve the problem, but it's so easy to import the lot
that it's not worth figuring out exactly which ones you need.

HTH,

Rob


accessuser1308 said:
Hello,

I currently have a form that contains a field that hyperlinks to a picture
file on my computer (jpeg and/or bmp). I do not want to store the actual
picture in my database, using a bound object, as it will make the database
huge. I have placed a web browser on my form and I would like to have it
display the picture located in the hyperlink. I have used the code below,
but I get an error stating that the file cannot be opened. I can open the
picture in IE7, but not in the web browser on the form. I would really
like
to be able to view my pictures on the form, without using a bound
object...and without going through the steps to convert them to html
files.
Also, I really want to avoid having to click the link to have another
program
open. I'd like to go record to record and have the images there, without
bogging down the database. I have had success using the web browser with
htm
files saved from word and excel. Is it possible to have an image show up
in
the web browser? Any suggestions would be greatly appreciated.

Thank you

Web Browser Code:

Private Sub Form_Current()
'Navigate to the current record's Web site
'If there's no URL stored in the field, then display Google search engine.

If Len([Image]) > 0 Then
ImageBrowser.Navigate URL:=[Gel]
Else
ImageBrowser.Navigate URL:="www.msn.com"
End If

End Sub
 
R

Rob Parker

Glad that you fixed your previous problem. As for the current one, the only
thing I've ever seen that will cause that error is that the file does not
exist - it's usually due to a typo somewhere in the path/filename. I
suspect that if the file is on a server, and you do not have read permission
on the folder, that you might get the same error, but I can't check that at
present. The file itself can be Read Only, and it will still display in the
image control.

HTH,

Rob


accessuser1308 said:
Please disregard my last post...I got rid of that error. Now when I go to
a
record in which there is a link (for a picture) I get an error message
stating that it cannot open the file. Do you know what might be causing
this. The entire path to the file is displayed in the "link" field.

Thank you

Rob Parker said:
You can use an Image control to display pictures on your form (in much
the
same way as you are trying to use a web browser control.

If your picture field has the full path/filename for the picture, you can
use something as simple as this, in the form's Current event, to display
the
picture in the image control:

If Not IsNull(Me.NameOfPhotoField) Then
Me.NameOfImageControl.Picture = Me.NameOfImagePathField
Me.NameOfImageControl.Visible = True
Else
'hide image control if no picture
Me.NameOfImageFrameControl.Visible = False
End If

To prevent Acces from crashing when scrolling rapidly through records
containing images, you need to modify some registry keys. The details
are
available at
http://www.mvps.org/access/downloads/Set_ShowProgressDialog_To_No.reg

The easy way to incorporate these is this: Cut/paste to a text file (I
used
Notepad), and save as a .reg file. Then all you need do is double-click
the
file, or right-click and choose "Merge", to merge the entries into your
registry. For a 19kb file of entries, that's certainly faster than
entering them all manually ;-) Note: there are more entries here than
are
actually needed to solve the problem, but it's so easy to import the lot
that it's not worth figuring out exactly which ones you need.

HTH,

Rob


message
Hello,

I currently have a form that contains a field that hyperlinks to a
picture
file on my computer (jpeg and/or bmp). I do not want to store the
actual
picture in my database, using a bound object, as it will make the
database
huge. I have placed a web browser on my form and I would like to have
it
display the picture located in the hyperlink. I have used the code
below,
but I get an error stating that the file cannot be opened. I can open
the
picture in IE7, but not in the web browser on the form. I would really
like
to be able to view my pictures on the form, without using a bound
object...and without going through the steps to convert them to html
files.
Also, I really want to avoid having to click the link to have another
program
open. I'd like to go record to record and have the images there,
without
bogging down the database. I have had success using the web browser
with
htm
files saved from word and excel. Is it possible to have an image show
up
in
the web browser? Any suggestions would be greatly appreciated.

Thank you

Web Browser Code:

Private Sub Form_Current()
'Navigate to the current record's Web site
'If there's no URL stored in the field, then display Google search
engine.

If Len([Image]) > 0 Then
ImageBrowser.Navigate URL:=[Gel]
Else
ImageBrowser.Navigate URL:="www.msn.com"
End If

End Sub
 

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

Top