Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Storing pictures on database 1

Status
Not open for further replies.

labanTek

Instructor
Dec 3, 2004
37
Hi to you all i really need some help with this. I have a table that stores the path to pictures in a folder. I have an image control in a form that renders the images on the form. Everytime I go to a new record on the form the image changes as expected but MS Access brings up a small window for a split second, that says "importing file C:/data/image1.jpg". How can I suppress this, so that the user does not see this file import. Thanks in advance
 
Convert the images to a windows format such as bitmap.

VBSlammer
redinvader3walking.gif

"You just have to know which screws to turn." - Professor Bob
 
But .jpg is a windows format. I think that with a .bmp it still will give the file import window.
 
Hi again VBSlammer I tried it and the file import window disappears in a much shorter time. Thanks for the reply
 
Window provides native support for bitmaps and metafiles, all others require a conversion.

VBSlammer
redinvader3walking.gif

"You just have to know which screws to turn." - Professor Bob
 
How do you create an image control in a form that renders an image on the form from a file path to a picture in a folder? Also, is this a better way to store large amounts of images rather than have the image actually stored in the database?

Your response wuld be helpful as I am just starting (as a novice to FP) building a database whose records will have numerous photos.

Thanks
 
labanTek,
Here's a registry hack that will disable the "importing" box:

HKEY_LOCAL_MACHINE\Software\Microsoft\ Shared Tools\Graphics Filters\Import\JPEG\Options

Change the ShowProgressDialog key value to "No"

NYMT,
You probably DO NOT want to load a bunch of images into your database. You should try loading 10 or 20, and see how much the DB grows, and then project that to the total number of pictures you are planning on loading. If you do load them into the DB, remember to save the native image files because it's a pain in the butt to extract the objects back out into image files.

As far as storing file paths in a table, then rendering them on the fly, all you need to do is, in the onCurrent event of the form (when you change records), just open a recordset with the appropriate image file paths in it, then set the imagebox.picture property to the appropriate file path. If you have multiple pictures for a single classification, you can add "next" and "back" buttons to the form, which navigate through the recordset.

It sounds more complicated than it is...

Good Luck,
Tranman
 
Try this:

Create a function-

Code:
Function setImagePath()
    Dim strImagePath As String
    On Error GoTo PictureNotAvailable
    strImagePath = CurrentProject.Path & Me.Pic
    Me.Cover.Picture = strImagePath
Exit Function
PictureNotAvailable:
    strImagePath = CurrentProject.Path
    
    strImagePath = strImagePath & "\Pics\NoPic.jpg"
    
    Me.Cover.Picture = strImagePath
End Function

Then in your form create a textbox for the Path to the picture on the form. It can be visible or invisible, no matter. If invisible shrink it down small and set it off on the side of the form. Create a picture image with the Picture tool. Pick any .jpg or .bmp image from your file as the source of the picture. After the picture is placed then open up on the properties and remove the Picture property path way. We are going to update it with each new record anyway.

Now in After Update event, use =setImagePath()

And if picture should change with record in On Current event, use:

Code:
setImagePath

    strImagePath = CurrentProject.Path

If Me.Pic = "\pics\nopic.jpg" Then
    Me.Pic.Visible = True
    Me.Pic_lbl.Visible = True
Else
    Me.Pic.Visible = False
    Me.Pic_lbl.Visible = False
End If

-----------------------------------------
"One Database to rule them all, One Database to find them,
One Database to bring them all and in the darkness bind them.
 
Tranman,

I made the adjustment to the registry as you suggested to disable the importing dialog box when importing a jpeg into a form, but I still see the box popup. Do you have any thoughts or suggestions?

Thank You.

Bill Meyers
 
Bill,
No, that registry change worked for me. Seems like it may have been under Access 97 or more likely 2K.

You would think it would work the same...

I have a report that loads about a zillion JPGs. Will try the change and see if it works for me here (Access 2003, WinXP Pro).

Tranman
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top