Combo box to return a number

Gkirkup

Registered User.
Local time
Today, 13:49
Joined
Mar 6, 2007
Messages
628
I want to use a combo box to select from a list that I will type - "Early", "On time", "Late", "Canceled", etc. But I want to return the selection NUMBER to my table, not the word. How do I do that?

Robert
 
Have a look at the attached sample - is this what you wanted?
 

Attachments

John: Excellent, thanks so much.

Robert
 
Be aware, when downloading this attached database, a setup exe is also downloaded and attempts to install a program named GameVance!

And this problem can also be solved without using a separate table and query, using one line of code in the combobox AfterUpdate event..

Code:
Private Sub ArrivalComboBox_AfterUpdate()
 Me.ArrivalStatus = ArrivalComboBox.ListIndex + 1
End Sub
 
Last edited:
missinglinq,

"Be aware, when downloading this attached database, a setup exe is also downloaded and attempts to install a program named GameVance!

I do not have GameVance on my computer - I have checked the registry and program files.

With reference to the post, I understood that he wanted to record the key (auto number) and not just increase the number by 1 ..... but I may be wrong.
 
Just reporting what happened when I downloaded it; didn't have anything else going on. Maybe something happened thru downloading from this site itself. Hopefully someone will check on that!

The OP said he wanted to record the "selection Number," by which I assumed he meant if "early" was selected, he wanted to return 1, since it's the first selection,if "On time" was selected, return a 2and so forth. He mentions nothing about a "key" or "auto number." In the code

Code:
Private Sub ArrivalComboBox_AfterUpdate()
 Me.ArrivalStatus = ArrivalComboBox.ListIndex + 1
End Sub

the line

ArrivalComboBox.ListIndex + 1

simply accomplishes this. The ListIndex is Zero-based, so it would return zero for the first item, not 1. Adding one simply adjusts for this.

Of course, we could both be wrong; always a possibility when answering questions that, perhaps, aren't stated as clearly as they could be!

Hope none of your family are in the path of the fires!
 
missinglinq,

Hope none of your family are in the path of the fires!

Thank you for your kind thoughts, The closest fire to our homes was about 5K’s (3 Miles) , it was only a small one and no home lost. Latest news here is 108 confirmed dead and about 750 homes gone. You may wish to read here: , it is Melbourne's main newspaper.

Maybe the OP will get back and tell use what he wanted.
 
Glad to hear that you and yours are safe, John! We've been following the horrific news closely, and your countrymen are in our prayers. We, of course, have our wildfires in California every year as well as some in my part of the country (Virginia) but never fatalities on this order.

God bless.
 
Be aware, when downloading this attached database, a setup exe is also downloaded and attempts to install a program named GameVance!

.......

Must be some weirdness on your computer missinglinq, as the zip downloaded fine and only contained John's DB no hidden extras.
 

Users who are viewing this thread

Back
Top Bottom