Forms & Photos

G

Guest

must be the spread of digital cameras......pics of items in inventory,
employees, even clients.... so need general advice. It is not a photo
db....a regular db but wanting a link to a jpg with a record on a Form.

I know you don't want to embed photos into the db itself....so I am
presuming a folder with all the jpgs...

I think will probably have a "See Picture" command button on the
Form...since in alot of general work there is no need to see the pic

If you have set this up would be interested in the syntax and method so that
one can relate a pic to an existing record on a Form.

gracias
 
G

Guest

thanks for the quick, helpful reply. Is late for me here so downloaded and
took a brief look at it. Looks like it is giving me a Table that will
accomplish the link to the photos - - - though haven't found explanation of
how....

and not quite sure where I go with this....import into my DB is my
guess....will look again at this in a.m. thanx
 
L

Larry Linson

NetworkTrade said:
If you have set this up would be interested
in the syntax and method so that one can
relate a pic to an existing record on a Form.

The sample imaging databases at http://accdevel.tripod.com illustrate three
approaches to handling images in Access, and the download includes an
article discussing considerations in choosing an approach. Two of the
approaches do not use OLE Objects and, thus, avoid the database bloat, and
some other problems, associated with images in OLE Objects.

If you are printing the images in reports, to avoid memory leakage, you
should also see MVP Stephen Lebans' http://www.lebans.com/printfailures.htm.
PrintFailure.zip is an Access97 MDB containing a report that fails during
the Access formatting process prior to being spooled to the Printer Driver.
This MDB also contains code showing how to convert the contents of the Image
control to a Bitmap file prior to printing. This helps alleviate the "Out of
Memory" error that can popup when printing image intensive reports.

Larry Linson
Microsoft Access MVP
 
G

Guest

Tom, a 2nd thank you for your info - - have looked at your instructions to
past inquiry that you linked, downloaded, cleaned up the Reference,
imported.....and everything works.

But....(you were waiting for the 'but'...I'm sure...) I don't see how one
integrates it. I have an existing form - I want the appropriate pic to open
via my form (that corresponds to the record of the form of course)...

Right now I have this new imported 'frmMain' - - which then opens to
request a Table - - one must select the correct Table...and then I can click
on my pictures....and it works...but it is not a method I would want a user
to have to do...and is completely independent from my existing Forms &
Records....

I don't see how to use this 'frmMain' from when I am at my Form with one
specific Record....and I've added a "See Pic" command button perhaps...I want
to open up the pic that corresponds to the ID on this record...

sorry to be extraordinarily slow on this one....
 
K

Keith

You can find the following on Microsofts website by typing "DisplayImage"

On your Form create an Image Frame named ImageFrame, a textbox named
txtImagePath, and a textbox named txtImageNote.
ImageFrame: Picture = directory path & Image Name. I.E.
F:\\Images\Image1.jpg
Type = Linked

Create a module:

Public Function DisplayImage(ctlImageControl As Control, strImagePath As
Variant) As String
On Error GoTo Err_DisplayImage

Dim strResult As String
Dim strDatabasePath As String
Dim intSlashLocation As Integer

With ctlImageControl
If IsNull(strImagePath) Then
.Visible = False
strResult = "No image name specified."
Else
If InStr(1, strImagePath, "\") = 0 Then
' Path is relative
strDatabasePath = CurrentProject.FullName
intSlashLocation = InStrRev(strDatabasePath, "\",
Len(strDatabasePath))
strDatabasePath = Left(strDatabasePath, intSlashLocation)
strImagePath = strDatabasePath & strImagePath
End If
.Visible = True
.picture = strImagePath
strResult = "Image Found and Displayed"
End If
End With

Exit_DisplayImage:
DisplayImage = strResult
Exit Function

Err_DisplayImage:
Select Case Err.Number
Case 2220 ' Can't find the picture.
ctlImageControl.Visible = False
strResult = strImagePath & " not found"
Resume Exit_DisplayImage:
Case Else ' Some other error.
MsgBox Err.Number & " " & Err.Description
strResult = "An error occurred displaying image."
Resume Exit_DisplayImage:
End Select
End Function
 
A

Arvin Meyer [MVP]

frmMain can be used to build a table from a known common image source, such
as a CD drive (usually D:\) or a share on a network drive. Once the table is
created, you can hide the create table button (Visible is set to No on the
property sheet) and let your users edit the table (or your own form) to add
or subtract any records. The rest of frmMain is just for displaying the
image.

In the applications I build, I typically import everything into my
application, and then customize what I need to use, and delete what is
superfluous.
--
Arvin Meyer, MCP, MVP
Free MS-Access downloads:
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com
 
G

Guest

thanks for input - - the button on frmMain opens the form to see the
images....I suppose that one can move that to a real form in use. But it
opens to the whole folder of pics that one can click thru and isn't
specifically linking one pic to one record....so more tweaking is necessary
for my application I guess.......
--
NTC


Arvin Meyer said:
frmMain can be used to build a table from a known common image source, such
as a CD drive (usually D:\) or a share on a network drive. Once the table is
created, you can hide the create table button (Visible is set to No on the
property sheet) and let your users edit the table (or your own form) to add
or subtract any records. The rest of frmMain is just for displaying the
image.

In the applications I build, I typically import everything into my
application, and then customize what I need to use, and delete what is
superfluous.
--
Arvin Meyer, MCP, MVP
Free MS-Access downloads:
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com
 
G

Guest

Actually after exploring and experimenting with the various suggestions given
- - - in the end I think the vanilla approach offered by Access is fine.

I added a new field to the existing table, defining the new field as an OLE
Image.... then in datasheet view I could right click on each record in that
new field and link to the appropriate image. [ link NOT embedded....]

Over in the Form, in design view, I could now find the Photo object in the
field list and just pasted that into the Form.

And everything works fine.

Admittedly if one ever must move the folder of photos - all those records
are going to be needed to be updated. And so a programmatic method would be
superior in such a situation....but....

However there seems so much advice steers me away from this simple approach
that I wonder if there is an additional downside that I am missing......
 

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