Mar 3 2004, 04:11 PM
This might be one of the more redundant questions found on this forum, but I honestly searched through all day at work and cannot find a clear answer on how to do this. I'm just trying to add a snapshot to each record I have in my table. I changed the snapshot field to OLE OBJECT. I drag and drop a JPG or PNG file and it goes in as a "Package". A bitmap goes in as "Bitmap Image" and shows up fine, however, Access doesn't recognize a JPG/PNG/etc. as a image at all. I have the latest SR-2 update on my Office 97 installed. Please don't tell me you can only embed BMP files into a table.
Edited by: Diversion on 03.03.04.
Mar 3 2004, 04:19 PM
The general method is NOT to store such items in the table. This results in bloated tables. What you do is store the path to image file and then use that path to display the image in an unbound control. I'm sure you can find picture catalogs that illustrate this here or other Access sources.
I'll give you a specific example that I did. I developed a catalog of the artwork in our offices. Each piece of art was assigned a number and a picture was taken and stored with the same number. The pictures were all stored in an Images subfolder of the folder where the app was stored.
On my form I put an unbound Image control. In the On Current event of the form I put code like the following:
Me!imgPic.Picture = strCurrDir & Me!txtArtID & ".jpg"
In my case strCurrDir was equal to H:\Artwork\Images\. You can set strCurrDir in a variety of ways.
I also used an IF to test whether the file existed and load a default image if it didn't to avoid errors.
Mar 4 2004, 06:00 PM
2 options that work fo rme.
If you have microsoft photo editor from Office 97 CD installed and this is default picture files viewer for your jpg's etc. then use this for OLE in table.
Do Insert Object then choose Microsoft Clip Gallery if you have it as an option.
Choose picture tab in the gallery then import your pics.
Once imported select picture then insert.
Hope that works for you.
Mar 5 2004, 10:03 AM
You say that you used an IF statement to test if the file exists. How did you do this?
I want to allow users to use any file typs such as jpg, bmp, gif etc. but I'm not sure how to do this
Mar 5 2004, 10:46 AM
This is the code I use:
Private Sub Form_Current()
Dim strFile As String
strFile = CurrDBDir() & "\images\" & Me!txtArtworkID & ".jpg"
If Dir(strFile) = "" Then
Me!imgPic.Picture = CurrDBDir() & "\images\notavail.jpg"
Me!imgPic.Picture = strFile
CurrDBDir is a custom function as follows:
Public Function CurrDBDir()
Dim strDBPath As String
Dim strDBFile As String
strDBPath = CurrentDb.Name
strDBFile = Dir(strDBPath)
CurrDBDir = Left(strDBPath, Len(strDBPath) - Len(strDBFile))
So the result is to build the path and filename as strPath then use the DIR function to determine if it exists.
If you want to use other then JPGs, then store the whole filename in your table record and drop the & ".jpg" from my example.
Mar 5 2004, 11:37 AM
So that's how you do it.
Mar 8 2004, 10:48 AM
ChrisLeClark, the 2nd option seems to work for me, although degrades the quality of the image a bit, any ideas?
Mar 9 2004, 07:44 AM
Picture quality should be as good as your saved picture.
In your bound object frame properties - look for the size mode property on the all tab and ensure it is set to zoom and your picture will display fully within the boundary of your bound object frame. If all of your pics are of similar height / width ratio then you can set the bound object frame height / width ratio siimilar.
I have no probs with picture quality providing the source image is sound.
Another thing I do is store all my pics in a seperate database. I have a table that contains the ID field and a picture field. This table stores the pics embedded, not linked. My main database contains a link to the table in this seperate pics database. In my main database I display the pictures in a subform which is using the linked table as the recordsource. Yes, my picture table becomes very bloated but it doesn't impair the performance of the main database because that is only updating each picture as it is accessed. I keep the pics database in the same folder as the main database or in a sub folder of the main database folder.
I thinks some of the earlier answers given provided better ways of storing pictures but given my Access limitations this was a good way for me and it works with minimal delay.
Hope this helps.
Nov 13 2004, 06:04 PM
I was wondering if anyone has suggestions on how to make this work with large reports. I have a database with artwork information for over 7000 pieces of art. All the images are stored in a folder with the same image number as JPG's. However, when I go to print a report with all the images in it, it dies after about 10 pages (4 images per page) because it runs out of memory. I have attempted to shut all other applications down, but it only helps marginally. If the images are smaller in size, it may process a few more pages before crashing.
I'm already doing the recommendations from earlier in this post. I'd like to know if there's a way to spool the report directly to the printer after each page's layout is completed or break up the report in an easy way.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here