Pictures - How can I use a table field in a URL?

N

Nick Marques

Ok, I would like to display a picture on my form. The pictures are stored on
the intranet site however, and use the following format
http://intranet/images/students/<idnumber>.jpg.

One of the fields on the table this form is using is idnumber. So, I would
essetially like to set the URL for the picture (Linked) to be what I showed
above, whereas the <idnumber> would be replaced with that field from the
table, hence producing the corrent URL for the picture. This seems simple
enough, but I can't figure out how to do it.

Any help??
 
A

Andrew Smith

You will need to use VBA code for this. You should put the code in the
current event of the form so that it runs when you move to a new record.
Also, I'm pretty sure (but may be wrong) that a normal image control can't
display an image from the internet/ intranet, so you may have to use a web
browser activex control instead.

If you use a web browser control called "web" then the code would be
something like this:

Const cstrPath as String = http://intranet/images/students/
Dim strURL as String

strURL = cstrPath & [idnumber] & ".jpg"
web.Navigate strURL

NB - this won't work for continuous forms, and the picture will not print.
 
N

Nick Marques

Hey, Thanks for the help with this --
I am a little confused though with the coding... I put this on the Current
Event of the Form object? I did that and got compile errors. Also, what
ActiveX Control would I use and what do I tell it for the Control Source or
for how to load the image??

If I use IE6 as browser, whould would replace web? Why does the browser I
use factor in to loading an image from a URL?

Thanks!
Andrew Smith said:
You will need to use VBA code for this. You should put the code in the
current event of the form so that it runs when you move to a new record.
Also, I'm pretty sure (but may be wrong) that a normal image control can't
display an image from the internet/ intranet, so you may have to use a web
browser activex control instead.

If you use a web browser control called "web" then the code would be
something like this:

Const cstrPath as String = http://intranet/images/students/
Dim strURL as String

strURL = cstrPath & [idnumber] & ".jpg"
web.Navigate strURL

NB - this won't work for continuous forms, and the picture will not print.


Nick Marques said:
Ok, I would like to display a picture on my form. The pictures are
stored
on
the intranet site however, and use the following format
http://intranet/images/students/<idnumber>.jpg.

One of the fields on the table this form is using is idnumber. So, I would
essetially like to set the URL for the picture (Linked) to be what I showed
above, whereas the <idnumber> would be replaced with that field from the
table, hence producing the corrent URL for the picture. This seems simple
enough, but I can't figure out how to do it.

Any help??
 
A

Andrew Smith

The code goes in the current event of the form as you say. You should use a
Microsoft Web Browser control. Just add it to the form and rename it "web"
(or any other name of your choosing). The code tells it which URL to open,
so you don't have to do anything else to it.

The code that I wrote has an error in it - there should be quotation marks
around the url:

Const cstrPath as String = "http://intranet/images/students/"

This is probably why you get the error.



Nick Marques said:
Hey, Thanks for the help with this --
I am a little confused though with the coding... I put this on the Current
Event of the Form object? I did that and got compile errors. Also, what
ActiveX Control would I use and what do I tell it for the Control Source or
for how to load the image??

If I use IE6 as browser, whould would replace web? Why does the browser I
use factor in to loading an image from a URL?

Thanks!
Andrew Smith said:
You will need to use VBA code for this. You should put the code in the
current event of the form so that it runs when you move to a new record.
Also, I'm pretty sure (but may be wrong) that a normal image control can't
display an image from the internet/ intranet, so you may have to use a web
browser activex control instead.

If you use a web browser control called "web" then the code would be
something like this:

Const cstrPath as String = http://intranet/images/students/
Dim strURL as String

strURL = cstrPath & [idnumber] & ".jpg"
web.Navigate strURL

NB - this won't work for continuous forms, and the picture will not print.


Nick Marques said:
Ok, I would like to display a picture on my form. The pictures are
stored
on
the intranet site however, and use the following format
http://intranet/images/students/<idnumber>.jpg.

One of the fields on the table this form is using is idnumber. So, I would
essetially like to set the URL for the picture (Linked) to be what I showed
above, whereas the <idnumber> would be replaced with that field from the
table, hence producing the corrent URL for the picture. This seems simple
enough, but I can't figure out how to do it.

Any help??
 
N

Nick Marques

Awesome! Got it to work... Now, this is just being picky, but is there any
way to ditch the picture top and left margins??

Thanks...
Andrew Smith said:
The code goes in the current event of the form as you say. You should use a
Microsoft Web Browser control. Just add it to the form and rename it "web"
(or any other name of your choosing). The code tells it which URL to open,
so you don't have to do anything else to it.

The code that I wrote has an error in it - there should be quotation marks
around the url:

Const cstrPath as String = "http://intranet/images/students/"

This is probably why you get the error.



Nick Marques said:
Hey, Thanks for the help with this --
I am a little confused though with the coding... I put this on the Current
Event of the Form object? I did that and got compile errors. Also, what
ActiveX Control would I use and what do I tell it for the Control Source or
for how to load the image??

If I use IE6 as browser, whould would replace web? Why does the browser I
use factor in to loading an image from a URL?

Thanks!
Andrew Smith said:
You will need to use VBA code for this. You should put the code in the
current event of the form so that it runs when you move to a new record.
Also, I'm pretty sure (but may be wrong) that a normal image control can't
display an image from the internet/ intranet, so you may have to use a web
browser activex control instead.

If you use a web browser control called "web" then the code would be
something like this:

Const cstrPath as String = http://intranet/images/students/
Dim strURL as String

strURL = cstrPath & [idnumber] & ".jpg"
web.Navigate strURL

NB - this won't work for continuous forms, and the picture will not print.


Ok, I would like to display a picture on my form. The pictures are stored
on
the intranet site however, and use the following format
http://intranet/images/students/<idnumber>.jpg.

One of the fields on the table this form is using is idnumber. So, I would
essetially like to set the URL for the picture (Linked) to be what I
showed
above, whereas the <idnumber> would be replaced with that field from the
table, hence producing the corrent URL for the picture. This seems simple
enough, but I can't figure out how to do it.

Any help??
 
A

Andrew Smith

Glad you've got it working. I've no idea about the margins thing.

One thing that I have found with the browser control is that you can't
resize it - don't ask me why, it must be a bug. If you need it a different
size to the one you first created then you have to delete it and add a new
one the right size.

Nick Marques said:
Awesome! Got it to work... Now, this is just being picky, but is there any
way to ditch the picture top and left margins??

Thanks...
Andrew Smith said:
The code goes in the current event of the form as you say. You should
use
a
Microsoft Web Browser control. Just add it to the form and rename it "web"
(or any other name of your choosing). The code tells it which URL to open,
so you don't have to do anything else to it.

The code that I wrote has an error in it - there should be quotation marks
around the url:

Const cstrPath as String = "http://intranet/images/students/"

This is probably why you get the error.



Source
or
browser
I
use factor in to loading an image from a URL?

Thanks!
You will need to use VBA code for this. You should put the code in the
current event of the form so that it runs when you move to a new record.
Also, I'm pretty sure (but may be wrong) that a normal image control can't
display an image from the internet/ intranet, so you may have to use
a
web
browser activex control instead.

If you use a web browser control called "web" then the code would be
something like this:

Const cstrPath as String = http://intranet/images/students/
Dim strURL as String

strURL = cstrPath & [idnumber] & ".jpg"
web.Navigate strURL

NB - this won't work for continuous forms, and the picture will not print.


Ok, I would like to display a picture on my form. The pictures are
stored
on
the intranet site however, and use the following format
http://intranet/images/students/<idnumber>.jpg.

One of the fields on the table this form is using is idnumber. So, I
would
essetially like to set the URL for the picture (Linked) to be what I
showed
above, whereas the <idnumber> would be replaced with that field
from
the
table, hence producing the corrent URL for the picture. This seems
simple
enough, but I can't figure out how to do it.

Any help??
 

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