mutiple image in a form

jeffrey159

Registered User.
Local time
Today, 05:25
Joined
Jan 17, 2013
Messages
24
How do i actually store and display my image in a form which works when i click on a item in the listbox and it will display the image i want

Currently i'm using a unbound form with listbox and rowsource from Queries.

When i click on the listbox it gave me
"you referred to a property by a numeric argument that's isn't one of the property numbers in this collection."
This is the code i tested
Private Sub List6_Click()
If Me.List6.ItemsSelected.Item(3) = "DF" Then
Me.Image32.Visible = True
End If
End Sub
the (3) is referred to the 3rd column of the listbox right? is it because the rowsource is from a query that's why i have that error or because the query contains multiple different tables?

is there any simple way to insert image into access and it will appear in just 1 image box ?
and depending on which item i click on the listbox the image will change?
 
Hello jeffrey159, I have in the past helped out another user for something similar.. Check out THIS thread for more info.. Post back if you are having troubles.. Hope this helps..
 
Hello jeffrey159, I have in the past helped out another user for something similar.. Check out THIS thread for more info.. Post back if you are having troubles.. Hope this helps..


but what if it's a listbox???
can you please tell me if the (3) is referred to the 3rd column of the listbox? if so why when i use Me.List6.ItemsSelected.Item(3) i get an error when i click on it
 
What is the Column Count, Row Source of the ListBox? Can you upload a STRIPPED version of your DB?
 
What is the Column Count, Row Source of the ListBox? Can you upload a STRIPPED version of your DB?

3 Column Count
Row Source is from a query
i have no idea how to strip my db to a smaller size but here it is. in Test Form

sorry, file is 2.2mb can't upload attachment

http://www.mediafire.com/?thqb67kbsmnaes9

EDIT: i don't know where should i insert and store my image in, i have 5 images i have to show in the Test Form depending on which item i select in the listbox.
 
Last edited:
Okay, ListBoxes in VBA are ZERO based... which means Column 1 is represented as 0, Column 2 as 1 so on..

Also you need to refer to the column not the ItemSelected..
Code:
If Me.List6[B].Column(2)[/B] = "DF" Then

Hope you are using the method of saving Images to Drive and only using the Path as in my example.. If you add images to the DB, you will start bloating the DB..

To create a Stripped DB means..
(to be uploaded for other users to examine)..

1. Create a backup of the file, before you proceed..
2. Delete all forms/Queries/Reports that are not in Question (except the ones that are inter-related)
3. Delete auxiliary tables (that are hanging loose with no relationships).
4. If your table has 100,000 records, delete 99,990 records.
5. Perform a 'Compact & Repair' it would have brought the Size down to measly KBs..
6. (If your Post count is Less than 10 ZIP the file and) Upload it..
 
Okay, ListBoxes in VBA are ZERO based... which means Column 1 is represented as 0, Column 2 as 1 so on..

Also you need to refer to the column not the ItemSelected..
Code:
If Me.List6[B].Column(2)[/B] = "DF" Then
Hope you are using the method of saving Images to Drive and only using the Path as in my example.. If you add images to the DB, you will start bloating the DB..

To create a Stripped DB means..

thanks a lot for your response/help:D
well i have no choice but to save images into the DB as my teacher instruct me to do so.

EDIT: Last question, if i want to have multiple image in 1 image box, how do i do so? do i have to create a table with the 5 images and control source it to the image box or OLEboundobject?
 
Glad to have responded/helped.. :)

But I would advice you to look into the Disadvantages of storing files in DB.. Unnecessary bloat, less efficient, you will hit the axe (i.e. limit of DB size) sooner or later etc.. So use it wisely.. Good Luck..
 
Access' attachment feature is very useful if the total number of attachments times their typical sizes aren't large. I use a mix of both techniques since my software ships with about 7000 images (all those private labels). The huge number of images and the lack of the attachment feature forced me to use the link storage technique years ago. It has it's own complications, as I had to provide a means to change the link path when users moved the back end, but that problem was easily overcome.

For stuff like employee records, I let my customers attach files and once file size exceeds a set limit, I'll develop code to allow them to offload and archive the images, storing the file names and paths during the archival process.

One the huge advantages for me in using attachments is that pictures can easily be displayed in continuous record forms (assuming only one picture and the picture is the first attachment). I always had trouble doing that with linked images and it sure makes for some pretty displays.

I've already solved the really tough problem (at least tough for me) which was to allow upgrades of the back-end and the attendant automatic moving of the records with attachments from an older back end to a new one. That took a lot of thought and work, but now that it's done, well anything is possible. I have some example databases on my developer's page for download if anyone is interested. I don't have enough posts yet to qualify for uploading, but if you go to informedcorp.com there is a link to the developer's page on the home page. The sample database is called "data mover".
 

Users who are viewing this thread

Back
Top Bottom