combo boxes n images

mattbland

Isnt really listening
Local time
Today, 08:44
Joined
Aug 8, 2002
Messages
33
In the database i am developing, i need a combo box to bring up a specific image file, depending on which value is selected in the combo box. Is this possible??? :confused: Im stumped!:confused:
 
yes.

in this example combo box values = a,b,c
here is some code. but its not totally vb code, just how it will work
-------------------------

dim combval as string

combval = Combobox.Value

if combval = a Then
display pic 1
else if combval = b Then
display pic 2
else if combval = c Then
display pic 3
endif

-------------------------
'if you want it to open a image file then use where it says "display pic 1"

followhyperlink ("c:\myfolder\pic1.jpg")

hope this helps
DAL
 
thanks
 
if u want it here is the actual workin code for opening an external pic
--------------------------
Private Sub Combo0_Change()
Dim comboval As String

comboval = Combo0.Value

If comboval = "a" Then
FollowHyperlink ("c:\myfolder\pic1.jpg")
End If
If comboval = "b" Then
FollowHyperlink ("c:\myfolder\pic2.jpg")
End If
If comboval = "c" Then
FollowHyperlink ("c:\myfolder\pic3.jpg")
End If

End Sub
----------------------------------
DAL
 
Alternative

In strongly recommend that you use an Image control to display the graphic files. Furthermore, you should store the graphic file names in a lookup table (minimum e fields: Autonumber/shortName/FileNameWithPath) that feed the combo box: column(0) = displays ShortName column(1) holds the file name. The code will be like follows:

Sub ComboBox_OnChange()

me!ImageBox.picuture=me!ComboBox.column(1)

end sub

Remember to activate an error procedure in case the file can not be found/loaded and de-activate the "Loading file"-message-box.


Select case me!comboBox
case 1
 

Users who are viewing this thread

Back
Top Bottom