If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Image Based on Combo Box Selection
I am creating a database (’97) with 2 tables, “Master Table” and “Equipment
Types” that will basically serve as an inventory control system. The Master Table will contain information about equipment that we loan out (i.e. serial numbers, date sent out, etc.) I have created a form based on the Master Table and on that form I have a drop-down/combo box based on the equipment table. What I would like to do is have an image displayed on the form of the piece of equipment that is selected in the combo box. I’ve been reading through the posts on these message boards and I see the repeated warnings about bloating the database by embedding the actual picture files into the database (not that I can figure out how to pull this off either way). Heeding that bit of advice though I went ahead and set up a folder on our shared network drive to contain all the pictures that I will need. Then I went back into my equipment table and added a text field called “ImagePath”, so by each type of equipment in the equipment table there is now a link that goes back to the corresponding picture of that piece of equipment. I went back to my form and played around with inserting an image control but I don’t really know what I’m doing. How do I essentially tie it to my combo box so that whatever is selected changes the picture (or can this even be done)? PS – My apologies for posting this on the general board…just wasn’t sure which of the others to put it on. |
#2
|
|||
|
|||
Image Based on Combo Box Selection
I have a demo that shows how to link the image to a record.
http://www.datastrat.com/Download/Picture2K.zip Use the after update event og the combo box to change the picture property (sample code): Sub MyCombo_AfterUdate() Me.ImageControlName.Picture = Me.MyCombo.Column(2) End Sub where MyCombo.Column(2) is the third column (width set to zero) of your combo box and containing the path to the image file. -- Arvin Meyer, MCP, MVP http://www.datastrat.com http://www.mvps.org/access http://www.accessmvp.com "jjones" wrote in message ... I am creating a database ('97) with 2 tables, "Master Table" and "Equipment Types" that will basically serve as an inventory control system. The Master Table will contain information about equipment that we loan out (i.e. serial numbers, date sent out, etc.) I have created a form based on the Master Table and on that form I have a drop-down/combo box based on the equipment table. What I would like to do is have an image displayed on the form of the piece of equipment that is selected in the combo box. I've been reading through the posts on these message boards and I see the repeated warnings about bloating the database by embedding the actual picture files into the database (not that I can figure out how to pull this off either way). Heeding that bit of advice though I went ahead and set up a folder on our shared network drive to contain all the pictures that I will need. Then I went back into my equipment table and added a text field called "ImagePath", so by each type of equipment in the equipment table there is now a link that goes back to the corresponding picture of that piece of equipment. I went back to my form and played around with inserting an image control but I don't really know what I'm doing. How do I essentially tie it to my combo box so that whatever is selected changes the picture (or can this even be done)? PS - My apologies for posting this on the general board.just wasn't sure which of the others to put it on. |
#3
|
|||
|
|||
Image Based on Combo Box Selection
The earlier part of your question was a bit confusing. Your descriptions
make it sound like you have already sucessfully gotten the image path (presumably path and file name) loaded into the field. (So, then, what is the combo box doing?) If so, then previous posts on this tell you how to make it show in the form. I'm not good enough to just describe it from memory, but I think that you just put in a sourceless "bound" control (box) for the picture (let's say it's name is "ImageBox") and then put code like the following into the "OnCurrent" event of the form: Me.ImageBox.Picture = Me.PicturePathAndFile ("PicturePathAndFile" is the name of the field with the picture path and file name in it) Being a dummy on this probably makes me better at explaining it, but don't trust my answer as being expert on the details Hope that helps a little. Sincerley, Fred |
#4
|
|||
|
|||
Image Based on Combo Box Selection
Beautiful. Thanks, Arvin!!!!!!!!
"Arvin Meyer [MVP]" wrote: I have a demo that shows how to link the image to a record. http://www.datastrat.com/Download/Picture2K.zip Use the after update event og the combo box to change the picture property (sample code): Sub MyCombo_AfterUdate() Me.ImageControlName.Picture = Me.MyCombo.Column(2) End Sub where MyCombo.Column(2) is the third column (width set to zero) of your combo box and containing the path to the image file. -- Arvin Meyer, MCP, MVP http://www.datastrat.com http://www.mvps.org/access http://www.accessmvp.com "jjones" wrote in message ... I am creating a database ('97) with 2 tables, "Master Table" and "Equipment Types" that will basically serve as an inventory control system. The Master Table will contain information about equipment that we loan out (i.e. serial numbers, date sent out, etc.) I have created a form based on the Master Table and on that form I have a drop-down/combo box based on the equipment table. What I would like to do is have an image displayed on the form of the piece of equipment that is selected in the combo box. I've been reading through the posts on these message boards and I see the repeated warnings about bloating the database by embedding the actual picture files into the database (not that I can figure out how to pull this off either way). Heeding that bit of advice though I went ahead and set up a folder on our shared network drive to contain all the pictures that I will need. Then I went back into my equipment table and added a text field called "ImagePath", so by each type of equipment in the equipment table there is now a link that goes back to the corresponding picture of that piece of equipment. I went back to my form and played around with inserting an image control but I don't really know what I'm doing. How do I essentially tie it to my combo box so that whatever is selected changes the picture (or can this even be done)? PS - My apologies for posting this on the general board.just wasn't sure which of the others to put it on. |
Thread Tools | |
Display Modes | |
|
|