Combo box Value Must Show an object: How To

vdanelia

Registered User.
Local time
Today, 05:20
Joined
Jan 29, 2011
Messages
215
Hello Dear friends, I have a question and Need your Help!

I have a form and Combo Box (Hardware) on it, with values: Swithc, Main board, Server, Desktop, etc.
For example When i choose from drop down list a Desktop or Server i want that near the combo box appear an image (something like icon which I'll set ) and when i click the image it will open additional form (Desktop Details) where i can enter or read the additional information about the desktop. I already have that form named details.
I just want only the function which will show that hidden image after i choose a desktop value from the combo box listing

Thank you very much
 
Hmmm... not sure, but off the top of my head could you have the image name as a hidden column in the combo box, then set the control source of your image object to be combo.column(x)? Bearing in mind that combo box column numbering starts from 0.
 
Then of course just a select case statemenet in the on click of your image object:
Code:
select case imagebox.image
 
Case image1
docmd.openform ...
 
Case image2
docmd.openform ...
 
...
 
End Select
 
Thanks James for your reply, I'll try that... and 'll post the results
 
Maybe I not described my problem well
Please Look at my test database
http://dl.dropbox.com/u/6200480/TEST.accdb
I put near the combo box a image (I set the Image property to hide)
When i Select from combo box Value Server this image must be visible, I couldn't manage the VBA code for it, maybe it looks like:


Select Case Me.Hardware
Case "Server"

and if case "Server" is chosen then the image (named ok.png near the combo box, which is hidden must be visible)

Case Else
DoCmd.OpenForm "ERROR", acNormal
End Select


Please Help!
 
Hi - I can't get into that link from here. Can you attach the file to a post?
 
Click on 'go advanced' at the bottom of the quick reply window and click on the little paper clip icon
 
First error that comes up is "Case without Select Case". Have a look in the help file. The structure is:
Code:
Select Case [I]expression[/I]
 
Case [I]Possible Expression 1[/I]
...
 
Case [I]Possible Expression 2[/I]
....
 
Case [I]N...[/I]
 
End Select
Anyway - to be clear - what you want is for the image box to become visible, and show the correct image, when you've made a selection from the combo box? Here's what to do:

Make the combo box select values from, I presume, the HARD table - at the moment it's looking at the DATA table. In the HARD Table, add a column with the path of the image you want to show in the image box. You can do this by using the expression builder on the combo box's row source, or recreating the combo box and using the wizard.

Thinking about it you don't need a select case to do this. In the combo box's afterupdate event, put something like this:
Code:
Imageboxname.visible=true
 
Imageboxname.image=comboboxname.column(1)
Assuming that the path to the image is in the second column of the table the combo box is looking at.
 
When I was talking about the select case statement, I was referring to when you click on the image top open the detail form.
 
:( Can't manage unfortunately

James Please edit and correct my test file and attach if you don't mind of course..
Thank you in advanced
 
Will try and find time today. It's quite easy, you've done half of it... just have a look through google and the help files, I'm sure you'll manage it
 
To be honest I found Image to be more intuitive than Picture. I wonder why they called it that.
 
Less than no idea VBA, however - ours is not to reason why :)
 
"add a column with the path of the image you want to show in the image box"

How to do this?
This seems very easiest way, but couldn't figured out...........
Ohhhhhhhhhhh I'm Comfusedddddd and go mad :(
 

Users who are viewing this thread

Back
Top Bottom