I have a folder on the server that
has a picture of all of our terminals. I
would like to set up a field in a database
table that takes the "terminal number",
concatenates .jpg to it and thus, have
a link to the image on the server?
What is the most logical way of doing this?
Please clarify: "link to the image on the server", "terminal number" if I
have guessed wrong:
I am guessing that "terminal number" would be a long integer input argument
to the procedure, "path to images" would be a string input argument to the
procedure, and that you want to set the Picture property of an Image control
named imgMyPic with the fully-qualified address of the image, so as to
display it on a Form. I am also going to arbitrarily assume that "terminal
number" is a numeric field up to 6 digits in length, that path to images
does not include a final "\". The following, in the Form's Module, could be
called from VBA code in the Form's OnCurrent event. I would suggest you
store the terminal number in your table, but, if it doesn't change very
often, you could define the strPath as a Constant in a standard module (not
a Form's module nor a Report's module).
Sub ShowIt(lngTerm,strPath)
Dim strPathAndName as String
strPathAndName = strPath & "\" & Format(lngTerm,"000000") & ".jpg"
Me!imgMyPic.Picture = strPathAndName
End Sub
Larry Linson
Microsoft Access MVP