Combo Box

D

Darren

How do you create a Combo box that has a drop down list containing "Yes" "No"
"NA" but returns a value,E.G "Yes"=10 "No"= 0 "NA" = Blank, in a seperately
created field I.E score.

I can create the Combo box but cannot get it to return the values as required.
 
G

Gerald Stanley

If the combo's RowSource is a Value List with Yes, No, N/A,
then you can put code into its AfterUpdate eventhandler
along the lines of
Select Case cmbChoice
Case "Yes"
txtScore = 10
Case "No"
txtScore = 0
Case Else
txtScore = ""
End Select

Hope This Helps
Gerald Stanley MCSD
 
C

C. Hammer

If you create a ComboBox (cmbBox) with two Rows and with the entries you
mentioned below, you can get the values in a Messagebox with this Code:


With cmbBox
MsgBox .Column(1, .ListIndex)
End With
 
B

Brendan Reynolds

Set the column count property to 2 and the Column Widths property to 0. This
hides the first column while allowing the second column, because we did not
specify any width for that column, to use the default size. If you want to
specify a size for the second column, separate the size of each column with
a semi-colon, e.g. 0;1.5.

Now set the Row Source Type property to Value List and the Row Source to ...

"10";"Yes";"0";"No";"";"N/A"

--
Brendan Reynolds (MVP)
http://brenreyn.blogspot.com

The spammers and script-kiddies have succeeded in making it impossible for
me to use a real e-mail address in public newsgroups. E-mail replies to
this post will be deleted without being read. Any e-mail claiming to be
from brenreyn at indigo dot ie that is not digitally signed by me with a
GlobalSign digital certificate is a forgery and should be deleted without
being read. Follow-up questions should in general be posted to the
newsgroup, but if you have a good reason to send me e-mail, you'll find
a useable e-mail address at the URL above.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top