Go Back   PCMech Forums > Help & Discussion > Software Discussion & Support

Need Some Help? Type Your Keywords Here:

Reply
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Old 10-26-2005, 12:30 PM   #1
Member (9 bit)
 
jalbes's Avatar
 
Join Date: Jul 2000
Posts: 257
Cool Change pictures on form with access

I'm working on a Quality Control Database to record the data taken from the Inspectors, and I'm interested to know if there's a way such that when the inspector chooses a "Product Code" from the drop down list in the form, the picture changes to the correct products picture.

Can this be done?

This isn't required but would be really handy to ensure that the inspector can visualize the correct board if he's unaware of the product code.
Let me know.

Thanks,
Shaun
Attached Files
File Type: zip Inspection Data.zip (47.8 KB, 38 views)
jalbes is offline   Reply With Quote
Old 10-26-2005, 12:37 PM   #2
Professional gadfly
 
doctorgonzo's Avatar
 
Join Date: Jan 2002
Location: Minneapolis, MN
Posts: 6,364
Send a message via MSN to doctorgonzo
Yes, it can be done, and there are several ways to do it.

The easiest way is to create a new field in the products table that is an OLE object data type. You can then easily add images to the table, and have them displayed on forms. The downside to this approach is that the images will be stored in the database, which will greatly expand its size.

Another way to do it would be to add a field to your products table that contains the location of an image file, for example located on the network. You could then use VBA code to load this picture on a form. This is more complicated, but it also doesn't increase the database size much at all because the images are stored elsewhere.

Edit: I took a look at your database, and it could really stand to use some redesign. You currently have the product codes listed as values in the dropdown box; this is a bad way to do it. Instead, create a new table with the product codes and description, and use that table as the source for the dropdown box. The one table you do have may need to be split up, depending on what you are doing with the data.

Last edited by doctorgonzo; 10-26-2005 at 12:40 PM.
doctorgonzo is offline   Reply With Quote
Old 10-26-2005, 02:51 PM   #3
Member (9 bit)
 
jalbes's Avatar
 
Join Date: Jul 2000
Posts: 257
Ok, thanks for the insight.

I'm going to split the table up just as you suggested. The pictures really aren't that big, so I'm going to insert them directly into the new table that I'll be creating (such that "product code" is in on field and "relative image" is beside it).

Now how exactly would I make it work so that when a "product code" is selected, that the correct picture loads up on the form? Is there a lookup command like in excel?

Excuse the simpleness of my question, but I rarely use access. I'm typically a die hard excel person.

Thanks,
Shaun
jalbes is offline   Reply With Quote
Old 10-26-2005, 03:05 PM   #4
Professional gadfly
 
doctorgonzo's Avatar
 
Join Date: Jan 2002
Location: Minneapolis, MN
Posts: 6,364
Send a message via MSN to doctorgonzo
What I would do is create a new form based on the Products table, and put the combo box and OLE field for the picture on that form. The information form would be a subform there. This allows you to simply bind the first form to the Products table, and pictures will automatically be loaded for the appropriate product. Otherwise, you may have to fiddle with the form's query to include the Picture field.

This site is a good reference for Access stuff.
doctorgonzo is offline   Reply With Quote
Old 10-26-2005, 03:51 PM   #5
Member (9 bit)
 
jalbes's Avatar
 
Join Date: Jul 2000
Posts: 257
Ok, I tried as you described and tried to find a relevant article in the website you refered me to, but I'm still stumped.

What I have right now is a table with just "Product Codes" and "Product Images" all set up. I made a separate form, but all that shows in place of the picture is the file location. If I double click this picture frame, the image opens up in a new screen under the default Windows Picture and Fax Viewer.

Any suggestions?
jalbes is offline   Reply With Quote
Old 10-26-2005, 03:53 PM   #6
Professional gadfly
 
doctorgonzo's Avatar
 
Join Date: Jan 2002
Location: Minneapolis, MN
Posts: 6,364
Send a message via MSN to doctorgonzo
Are you storing the image in the table or just its location?
doctorgonzo is offline   Reply With Quote
Old 10-26-2005, 04:02 PM   #7
Member (9 bit)
 
jalbes's Avatar
 
Join Date: Jul 2000
Posts: 257
Quote:
Originally Posted by doctorgonzo
Are you storing the image in the table or just its location?
It's still in the seperate table along with the "product codes"
jalbes is offline   Reply With Quote
Old 10-26-2005, 04:06 PM   #8
Professional gadfly
 
doctorgonzo's Avatar
 
Join Date: Jan 2002
Location: Minneapolis, MN
Posts: 6,364
Send a message via MSN to doctorgonzo
Quote:
Originally Posted by jalbes
It's still in the seperate table along with the "product codes"
Right, but are you storing the pictures themselves in an OLE field in the table, or are you storing their actual location ("C:\Pictures\Item1.bmp") in a text field in the table?
doctorgonzo is offline   Reply With Quote
Old 10-26-2005, 05:06 PM   #9
Member (9 bit)
 
jalbes's Avatar
 
Join Date: Jul 2000
Posts: 257
Yeah, I'm storing the pictures in an OLE field within the table and not just a file location. When I copy and paste the file into the image "OLE" field, the field populates with the word "Package".

Hope thats a bit more clear. Any idea's?
jalbes is offline   Reply With Quote
Old 10-26-2005, 05:27 PM   #10
Member (9 bit)
 
jalbes's Avatar
 
Join Date: Jul 2000
Posts: 257
Ok, I managed to get the one form to display the image. I was using the form wizard and it wasn't working, so I deleted the Object Frame that the wizard inserted and reinserted a new Object Frame manually and linked it to my images field, (same as the wizard performed it) and now it works.

So now how do I link that sub form into my main form?
jalbes is offline   Reply With Quote
Old 10-27-2005, 09:16 AM   #11
Member (9 bit)
 
jalbes's Avatar
 
Join Date: Jul 2000
Posts: 257
Ok, I came back to work today after playing with it at home for a bit last night and I managed to figure out how to insert a form as a subform and linked the Product code as the child and master fields.

However, When I tried viewing the images after doing what I did at home with the deleting the Object Frame that the wizard inserted and reinserted a new Object Frame manually and linked it to my images field, the image fails to appear, so I'm back to where I was yesterday, as far as the image is concerned.

I included a screen shot of what I'm viewing and the field in the table is set up as an OLE field. So what am I doing wrong?

Any idea's?

Also, is there anyway to remove the record navigation bar at the bottom of the sub form? It's obviously not required.

Thanks,
Shaun
Attached Images
File Type: jpg screener.jpg (94.8 KB, 27 views)
jalbes is offline   Reply With Quote
Old 10-27-2005, 10:00 AM   #12
Professional gadfly
 
doctorgonzo's Avatar
 
Join Date: Jan 2002
Location: Minneapolis, MN
Posts: 6,364
Send a message via MSN to doctorgonzo
I think you may have misunderstood what I said. The main form should contain the product code and the picture. The subform should contain all the other data. It looks like you have the subform containing the picture.

I've attached something I did very quickly to illustrate what I had in mind.
Attached Files
File Type: zip Inspection Data.zip (42.2 KB, 33 views)
doctorgonzo is offline   Reply With Quote
Old 10-27-2005, 10:53 AM   #13
Member (9 bit)
 
jalbes's Avatar
 
Join Date: Jul 2000
Posts: 257
Huh, thats strange...

I can see your bitmap images, but when I try inserting my images into your table, I still get no image. I flip through the first 2 records that you made and see the bitmaps, but then records 3 and 4 that I made don't show an image. I've tried different image types too. .jpg, .gif, & .bmp. Still no image, just file name. I checked all your setting for your Object Frame and they match.

The only thing that doesn't match is in the table itself. When I copy and paste the file into the OLE field, I get "Package" that populates in the cell. With yours, I see "Bitmap Image". How are you inserting the file into the OLE Feild cells?
Attached Images
File Type: jpg mine.jpg (83.4 KB, 26 views)
File Type: jpg yours.jpg (44.2 KB, 28 views)
jalbes is offline   Reply With Quote
Old 10-27-2005, 10:56 AM   #14
Professional gadfly
 
doctorgonzo's Avatar
 
Join Date: Jan 2002
Location: Minneapolis, MN
Posts: 6,364
Send a message via MSN to doctorgonzo
When you are in the picture field in the table, click on Insert, then Object. Select "Create from file" and browse to the picture, then hit OK. It has to be a BMP file, other file types will not be displayed automatically.
doctorgonzo is offline   Reply With Quote
Old 10-27-2005, 12:02 PM   #15
Member (9 bit)
 
jalbes's Avatar
 
Join Date: Jul 2000
Posts: 257
Thumbs down

OK, I think that I found my issue:

http://support.microsoft.com/?kbid=8...23120121120120

Office 2003 doesn't support Microsoft Photo Editor anymore. When Microsoft Photo Editor is installed, it allows access to find the OLE Server that can correctly interpret the OLE object header information.

Unfortunately the fix requires you to install Microsoft Photo Editor from Office XP which I don't have access to.

Am I understanding this correctly?

Does anyone know of another workaround for this?
jalbes is offline   Reply With Quote
Old 10-27-2005, 12:11 PM   #16
Professional gadfly
 
doctorgonzo's Avatar
 
Join Date: Jan 2002
Location: Minneapolis, MN
Posts: 6,364
Send a message via MSN to doctorgonzo
It will probably be far easier to store the locations to the images in the tables instead. Store the path in the table, then add an image control to the form. Using VBA, change the image control's picture property to the location of the product.

Again, I've put together something quickly. Assuming you have the two files in your Windows directory, the pictures should show up on the form. Pay attention to the form's VBA code to see how I did it.
Attached Files
File Type: zip Inspection Data.zip (23.6 KB, 26 views)
doctorgonzo is offline   Reply With Quote
Old 10-27-2005, 12:52 PM   #17
Member (9 bit)
 
jalbes's Avatar
 
Join Date: Jul 2000
Posts: 257
OK, I'll play with that tonight when I get home and let you know how it goes. Thanks for all the support doctorgonzo!
jalbes is offline   Reply With Quote
Reply

Bookmarks

Still Need Help? Type Your Keywords Here:


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -5. The time now is 07:57 PM.
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.
SEO by vBSEO 3.6.0 PL2