Images in a Database

  • Thread starter marcfromm via AccessMonster.com
  • Start date
M

marcfromm via AccessMonster.com

I created a database to track a collection. I have bmp files of all the items.
When I first inserted the images in the “OLE Object†field labeled
“itemImage†I did not click the linked box. Later I figured I would like the
images linked so that if I change an image the new image (with the same name)
would be seen in the database. I reinserted all the mages for each record and
selected the linked box in the process.

Several strange things happened.
1. The database doubled in size. I tried “repair and compact†but the db
remained as big.
2. I edited a picture and then opened the db, but the original image was
still shown.
3. I deleted an image and renamed a different image to the same name as the
deleted image. I opened the database to see the deleted image still in the
record. The thumbnail of the renamed image looks like itself, but if I open
the renamed image, it changes and looks like the deleted image.

What is going on with these images?

thanks
 
G

Guest

First don't store your images in your database.
Store the Path to the image in a memo field in your database.
Display your images, through Form(s).
I use this all the time e.g. A Part Number points to the Image of the Part
every time that part is displayed on a form the image can be displayed.
Just structure your library of pictures/images so it's easy to follow.
 
M

marcfromm via AccessMonster.com

Thanks for your reply. I looked up the path method in the help, but it states
using a text field and requires VB code being placed into a module. Is this
what you are talking about? In a form do I just type in the path?

thanks
First don't store your images in your database.
Store the Path to the image in a memo field in your database.
Display your images, through Form(s).
I use this all the time e.g. A Part Number points to the Image of the Part
every time that part is displayed on a form the image can be displayed.
Just structure your library of pictures/images so it's easy to follow.
I created a database to track a collection. I have bmp files of all the items.
When I first inserted the images in the “OLE Object†field labeled
[quoted text clipped - 16 lines]
 
G

Guest

Yes you will need a little VBA to do this.
(For the explanation I have invented some names
substitute your own names.)
Suggest for your Access Table named PI_Pictures

PIID Key field Autonumbered
PicPath Memo field - will hold full path and file name of your picture.
PicDesc Text field brief desc of your Picture.

I am assuming either an aversion to or fear of VBA.
Have a form with a combo box in the header.
Also assuming a fear of queries so I won't
show alpha list by PicDesc
the list will be in PIID order.
Combo Box cmbPI
No Control Source
Row Source : PI_Pictures
Bound Column : 1
Column Count : 3
Column Widths : 0cm;0cm;6cm

Have an Image box in your Detail section of the form imgPic.

In the After Update event of cmbPI
(the VBA stuff)

imgPic.picture=cmbPI.column(1)

Three columns in the combo box numbered 0,1,2

Play around with this - it will show the latest
image from the file. Then think around how to setup and save your
image paths on PI_Pictures using a form.

Just a wee suggestion - think outside the box.

Cheers
AuldMannie

marcfromm via AccessMonster.com said:
Thanks for your reply. I looked up the path method in the help, but it states
using a text field and requires VB code being placed into a module. Is this
what you are talking about? In a form do I just type in the path?

thanks
First don't store your images in your database.
Store the Path to the image in a memo field in your database.
Display your images, through Form(s).
I use this all the time e.g. A Part Number points to the Image of the Part
every time that part is displayed on a form the image can be displayed.
Just structure your library of pictures/images so it's easy to follow.
I created a database to track a collection. I have bmp files of all the items.
When I first inserted the images in the “OLE Object†field labeled
[quoted text clipped - 16 lines]
 
J

Jeff Boyce

The suggestion that you store the image files somewhere and store the path
to those files in your Access database may be, in part, a work-around
because Access did not handle images well before.

Earlier versions of Access tended to bloat if you stored images. From what
I understand, the most recent version (2007) is supposed to handle images
better. From my experience, a SQL-Server back-end has worked quite well
managing stored images.

When I researched whether SQL-Server could handle images (vs. using
"pointers"), I found the arguments to be "you should" and "you shouldn't",
without any explanation.

Perhaps other folks have had other experiences...

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
M

marcfromm via AccessMonster.com

I am lost with how to do this. I have tried to follow the steps in this MS
article:
http://support.microsoft.com/kb/285820/ but I do not understand the Image
Control step.
I cannot find a way to make the image control on the form or report as
directed to do in the KB285820.
Yes you will need a little VBA to do this.
(For the explanation I have invented some names
substitute your own names.)
Suggest for your Access Table named PI_Pictures

PIID Key field Autonumbered
PicPath Memo field - will hold full path and file name of your picture.
PicDesc Text field brief desc of your Picture.

I am assuming either an aversion to or fear of VBA.
Have a form with a combo box in the header.
Also assuming a fear of queries so I won't
show alpha list by PicDesc
the list will be in PIID order.
Combo Box cmbPI
No Control Source
Row Source : PI_Pictures
Bound Column : 1
Column Count : 3
Column Widths : 0cm;0cm;6cm

Have an Image box in your Detail section of the form imgPic.

In the After Update event of cmbPI
(the VBA stuff)

imgPic.picture=cmbPI.column(1)

Three columns in the combo box numbered 0,1,2

Play around with this - it will show the latest
image from the file. Then think around how to setup and save your
image paths on PI_Pictures using a form.

Just a wee suggestion - think outside the box.

Cheers
AuldMannie
Thanks for your reply. I looked up the path method in the help, but it states
using a text field and requires VB code being placed into a module. Is this
[quoted text clipped - 14 lines]
 
G

Guest

Do you anything about forms in Access?

An Image Control is like a combo box Control, a Text box control and can be
found near these in design Mode.

Create a new form.

In Design Mode

Put an Image control onto the form. Click on the Image control Icon then
move the cursor onto the from and click on the form an Image control will be
put on the form. You need to be able to see the properties of the Image
control. If you don't see a floating (on top) window called Properties, then
hover the mouse over the Image Control you just added and right click and
select properties. There is a list of things you can change here. I suggest
Size Mode: Stretch
Picture alignment: Centre
Picture: "C:\Pictures\Pic001.bmp"
(Get rid of the quotes and put one of your Image File names there)

Now Open the form.

The image should appear in the Image control on the form.

go back into Design Mode and change the properties to another Image file name.

new image will appear.

(that is approximately what should happen)

The code in the kb article is to check that the File name you have in your
Table, as the pointer to an image actually exists, and either turn on or off
the property of the image control visible switch.

Note - Microsoft (at least used to) have some on line tutorials on using
Access which may benefit you.

I hope I have pitched this at the appropriate level.

Cheers
AuldMannie

marcfromm via AccessMonster.com said:
I am lost with how to do this. I have tried to follow the steps in this MS
article:
http://support.microsoft.com/kb/285820/ but I do not understand the Image
Control step.
I cannot find a way to make the image control on the form or report as
directed to do in the KB285820.
Yes you will need a little VBA to do this.
(For the explanation I have invented some names
substitute your own names.)
Suggest for your Access Table named PI_Pictures

PIID Key field Autonumbered
PicPath Memo field - will hold full path and file name of your picture.
PicDesc Text field brief desc of your Picture.

I am assuming either an aversion to or fear of VBA.
Have a form with a combo box in the header.
Also assuming a fear of queries so I won't
show alpha list by PicDesc
the list will be in PIID order.
Combo Box cmbPI
No Control Source
Row Source : PI_Pictures
Bound Column : 1
Column Count : 3
Column Widths : 0cm;0cm;6cm

Have an Image box in your Detail section of the form imgPic.

In the After Update event of cmbPI
(the VBA stuff)

imgPic.picture=cmbPI.column(1)

Three columns in the combo box numbered 0,1,2

Play around with this - it will show the latest
image from the file. Then think around how to setup and save your
image paths on PI_Pictures using a form.

Just a wee suggestion - think outside the box.

Cheers
AuldMannie
Thanks for your reply. I looked up the path method in the help, but it states
using a text field and requires VB code being placed into a module. Is this
[quoted text clipped - 14 lines]
 
M

marcfromm via AccessMonster.com

I have done these steps already in the Form Design Mode with the Image tool
from the Tool Box. I click on the image tool, I click on the form, a window
pops up to browse to a graphic file, and if I select a file the image is
placed on the form and that is it. All that appears to happen is it makes my
db go form 500KB to 2500KB. This is obviously not linking the image, but
embedding it. Also it is not being assigned to the record that I want the
image to go with. I do not see how this is different than my original post
with using the OLE object.

What am I missing?
I have all the image file names in a table. The access db is in the same
folder as the images, thus no path is required. I want to link the
appropriate image from the image table to the item in the item table and not
have the image embedded into the db.
Do you anything about forms in Access?

An Image Control is like a combo box Control, a Text box control and can be
found near these in design Mode.

Create a new form.

In Design Mode

Put an Image control onto the form. Click on the Image control Icon then
move the cursor onto the from and click on the form an Image control will be
put on the form. You need to be able to see the properties of the Image
control. If you don't see a floating (on top) window called Properties, then
hover the mouse over the Image Control you just added and right click and
select properties. There is a list of things you can change here. I suggest
Size Mode: Stretch
Picture alignment: Centre
Picture: "C:\Pictures\Pic001.bmp"
(Get rid of the quotes and put one of your Image File names there)

Now Open the form.

The image should appear in the Image control on the form.

go back into Design Mode and change the properties to another Image file name.

new image will appear.

(that is approximately what should happen)

The code in the kb article is to check that the File name you have in your
Table, as the pointer to an image actually exists, and either turn on or off
the property of the image control visible switch.

Note - Microsoft (at least used to) have some on line tutorials on using
Access which may benefit you.

I hope I have pitched this at the appropriate level.

Cheers
AuldMannie
I am lost with how to do this. I have tried to follow the steps in this MS
article:
[quoted text clipped - 47 lines]
 
G

Guest

Moved back over.

Lets see if we can get a wee bit further

An extract from one of my Forms with an Image Control called Logo.
The variables "A_*" are global variables saved at startup.
This was extracted from my Form_Open Procedure.
The "None" is placed there programatically if the Path is invalid.
i.e. don't show anything if you can't get the image.

If A_LogoPath = "None" Then
Logo.Visible = False
Else
If Dir(A_LogoPath) <> "" Then
Logo.Height = A_LogoHeight
Logo.Width = A_LogoWidth
Logo.Picture = A_LogoPath
End If
End If

Logo Properties include
Picture : (none)
Picture Type : Linked

In design Mode - Note Logo Control is set to be visible so just needs
switching off, in my example.

When the Form is opened the Picture from the path is opened.
If the path is changed in the table, the new picture opens.
A_LogoHeight and A_LogoWidth are obtained from another part of the system.
That way the User can size the Image Control to best show their Logo.
The image displayed can be changed after open, and is when the user uses the
other part of the system to add/change their logo and size it accordingly.
That is for another day. Lets just try and get you going.

If you could copy and paste what you are doing, I'll see if I can help more.

Cheers
AuldMannie
 
M

marcfromm via AccessMonster.com

I hope this makes sense.

This is what I have so far:
Item Table
Field Data Type
itemName Text
itemType Text
itemDate Number (it is a number becasue I am only using
years; no months or days)
itemComment Text
ID AutoNumber

Image Table
Field Data Type
pathToImage Text
ID Autonumber AutoNumber

The Item Table has a form that allows me to input the data for each item.
The Image Table has a form (as of yesterday) that allows me to see the image
in the form according to the pathToImage information.

Previously in the Item Table, I had an OLE object field to include a picture
of the item with its record of name, type, date and comment. The form and
report displayed the image of the item with its record informatiuon since it
was embedded in the db. This method was ugly--large db and cumbersome image
update.

I would like to know if it is possible and if yes, how to link the images in
the Image Table (which are just text paths to the actual images) to a record
in the Item table, and thus be able to select correct images in the Item Form
as I input item records into the Item Table. Since the image table is just a
list of paths, all I get is the path text.
 
G

Guest

If you do need this then you have to link the tables by e.g. having a Field
ItID Number(Long Integer) in the Image Table, so you can tell which Item
Table ID the Image is for this way an Item can have lots of images, which is
what I think you want.

Once you have determined the way you are going to make your link, Lets say
the one I've suggested. Make the form that displays the image a subform of
the form that lets you enter the Item information just to test this. Link the
Image subform to the Item form using the ItID I have suggested above. When
you open your Item form the subform will be displayed. Since you have no
built in Connection, no records will display. The Item form will not display
continuous forms however the subform should be set up to do that. Call this
form ImagesByItemfrm or whatever you like and whatever you naming convention
is.

There are lots of ways of doing this but what you want to be able to do is
actually on the Image form be able to select which Item the Image is for
(with the link the way it is). One way is to make the Input box for the Item
Number (on your Image Form) a Combo box based on the Item File. You can then
scroll through this and select the Item. Keep it simple to begin with. This
will populate the ItID in the Image file. If you have column width for the
ItID set to zero, and the Item Name as the second column in the combo box you
will see the Item Name. Once you have done this lets say for a few
items/images, use the ImagesByItemfrm, to get a list of images associated
with the Items.

This is off the top of my head. Try it. I have historically had a one to one
relationship between Item and Image, and the Image path stored in the Item
Record. The above should work, however it is rough and ready, and should be
smartened up to better suite your way of working.

Hope this helps

Cheers
AuldMannie
 
M

marcfromm via AccessMonster.com

I got it all figured out. The explanation would be too long. I can now input
a record and select an image to be associated with the corresponding item,
without using the OLE object bloat and terrible functionality. Thanks for the
direction and the help.
If you do need this then you have to link the tables by e.g. having a Field
ItID Number(Long Integer) in the Image Table, so you can tell which Item
Table ID the Image is for this way an Item can have lots of images, which is
what I think you want.

Once you have determined the way you are going to make your link, Lets say
the one I've suggested. Make the form that displays the image a subform of
the form that lets you enter the Item information just to test this. Link the
Image subform to the Item form using the ItID I have suggested above. When
you open your Item form the subform will be displayed. Since you have no
built in Connection, no records will display. The Item form will not display
continuous forms however the subform should be set up to do that. Call this
form ImagesByItemfrm or whatever you like and whatever you naming convention
is.

There are lots of ways of doing this but what you want to be able to do is
actually on the Image form be able to select which Item the Image is for
(with the link the way it is). One way is to make the Input box for the Item
Number (on your Image Form) a Combo box based on the Item File. You can then
scroll through this and select the Item. Keep it simple to begin with. This
will populate the ItID in the Image file. If you have column width for the
ItID set to zero, and the Item Name as the second column in the combo box you
will see the Item Name. Once you have done this lets say for a few
items/images, use the ImagesByItemfrm, to get a list of images associated
with the Items.

This is off the top of my head. Try it. I have historically had a one to one
relationship between Item and Image, and the Image path stored in the Item
Record. The above should work, however it is rough and ready, and should be
smartened up to better suite your way of working.

Hope this helps

Cheers
AuldMannie
I hope this makes sense.
[quoted text clipped - 68 lines]
 

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