percentage in combo box format

Dear experts -
I have a combo box with these columns:
column 0: [decimal number between 0 and 1]
column 1: textual representation of same: 0%, 20%, 60%, 100% [just a few specified values]
column 2: description text (explaining how this value is used, e.g., 'a complete certainty').

Column 0 is the bound column.

So far, so good.

Now, I have another control on the form that has other default decimal values (e.g., .5 or .8); if the user selected a value in THIS combo box, I want to give the user the option to make THIS the selection in the previously mentioned combo box.

I have been attempting this with the code below. HOWEVER, the other columns are absent and the combo box is showing blank. How do I deal with this - i.e., if user wishes to use the new value, how do I populate the combo box properly?



If Nz(Me.cboProbability, 0) = 0 Then
    Me.cboProbability = Val(Me.cboStatus_ID.Column(2))
ElseIf Me.cboProbability <> Val(Me.cboStatus_ID.Column(2)) Then
    If MsgBox("The default probability for this stage is " & Val(Me.cboStatus_ID.Column(2)) * 100 & "%. Would you like to use the default value?", vbYesNo) = vbYes Then
        Me.cboProbability = Val(Me.cboStatus_ID.Column(2))
    End If
End If
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Jeffrey CoachmanMIS LiasonCommented:
Just leave all the values as raw decimal
.01, .02, .03, ...etc
You can then just format the individual controls by setting the "Format" property to: "Percent"

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Jeffrey CoachmanMIS LiasonCommented:
Oh, I misunderstood your question.

1. It looks like your Column Indexes are off.
If you have two columns in your combobox, .column(0) is the first,  and .column(1) is the second (these are zero based values).

So give that a try...

Also, not sure why you need the Val() function there...?
terpsichoreAuthor Commented:
this was the simple answer; i had a second column displaying the percentage, which was superfluous and conflicting when i was adding the value from the other table (since the displayed column didn't exist. Thanks!
Jeffrey CoachmanMIS LiasonCommented:
Yes, I was not "exactly" sure of your question...
So I threw out both of those suggestions...

Glad I could help...

...And just to be clear, ...a combobox will display the value as text, but you can still reference the column and get the correct "numeric" value, without the Val() function...


It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.