Question How to retrieve icons in Forms? (1 Viewer)

MyTech

Access VBA
Local time
Today, 00:52
Joined
Jun 10, 2010
Messages
108
I am working on a "Toners Bought and Sold" database with a "Box" field keeping track if the toner was bought either normally packaged ('Closed' box), in an open box ('Open' box) or without a box ('No' box).

I have 3 BMP files saved on my computer, 1- a closed box, 2- an open box, 3- a big X standing for 'No box'.

I want to have a field in my form to display an icon in each record, depending on the contents in the "Box" field.


My question is how do I handle images in Access?
Can I put the pictures in a Table as OleObject field and retrieve them from there? (the 'Lookup' part I'm ok with)
Should I create a certain Module?

Please help.
 

John Big Booty

AWF VIP
Local time
Today, 14:52
Joined
Aug 29, 2005
Messages
8,263
Don't store images in your DB, this will cause unnecessary DB bloat. Simply store the images in a file and refer to their location as required. Have a look at the sample posted here for an example
 

MyTech

Access VBA
Local time
Today, 00:52
Joined
Jun 10, 2010
Messages
108
Thank you John, good sample.

However, I have a problem.

I'm trying to do this in a continuous form and when I use your sample, ALL records are being changed instead of only the record selected.
Is there a small change I have to make in it?


EDIT:

I got it, I had to select a Control Source.
I'll report if everything ended up OK.
 
Last edited:

John Big Booty

AWF VIP
Local time
Today, 14:52
Joined
Aug 29, 2005
Messages
8,263
Ah, continuous forms :eek: they will always cause you problems with this sort of task.

Perhaps this link will give you some pointers.
 

John Big Booty

AWF VIP
Local time
Today, 14:52
Joined
Aug 29, 2005
Messages
8,263
The problem with continuous forms, is that with this sort of control, that varies from record to record, and is dependant on a reference from the current record. Is that all the controls will show the record/image that is related to the record that currently holds focus, rather than the appropriate record/image for each record. I believe that Access '07 may be a little more compliant in this area.
 

MyTech

Access VBA
Local time
Today, 00:52
Joined
Jun 10, 2010
Messages
108
I'm Using 2010 and it's not any better. I tried setting the "Picture" property to "Me.BoxCombo.Column(2)" but no, it asks me for an actual file name.

Thank you anyway John for sharing your great ideas.

I'll try my luck in a new post.
 

John Big Booty

AWF VIP
Local time
Today, 14:52
Joined
Aug 29, 2005
Messages
8,263
No luck with the solution offered by Roger in the link in my post #4?
 

MyTech

Access VBA
Local time
Today, 00:52
Joined
Jun 10, 2010
Messages
108
My continuous form will contain hundreds of records, and growing.
As far I understood before your last comment, i thought I'll have to create a single form and set hundreds of records.

After your previous comment, I tested your DB and realized that I just have to fill 1 page.
I'll check it out throughly another time, Thank you very much.
 

Users who are viewing this thread

Top Bottom