Log in

View Full Version : Display Corresponding Value From Adjacent Column Based On Change of DropDown ComboBox



mosesena
11-26-2013, 06:34 PM
I have two columns of data. The first contains 'names' and the second contains 'passwords'. The Userform is completed with information plus a combobox displaying 'names'. When the command button is clicked, the information is updated to a database and the 'name' selected in the combobox should display the matching 'password' on a message box.

The question is how do I code the combobox element of the userform to display on a message box, the 'password' matching the 'name' selected?

alansidman
11-26-2013, 09:00 PM
Look at this attached file.

Open the VBE. Look at the Row Properties for the Combo Box and then look at the code for the text box.

mosesena
11-26-2013, 10:25 PM
That is perfect but the display of 'password' should be in a message box and should happen when the user hits a command button.

alansidman
11-26-2013, 10:51 PM
Ok. No worries. Look at the attached.

mosesena
11-27-2013, 01:13 AM
That works....Thanks

mosesena
11-27-2013, 01:26 AM
Ok. No worries. Look at the attached.

That certainly works...Thanks. The other part of it is ....if a user selects a name and password, that name and password should not be available for the next user. Question is how do I code it?

alansidman
11-27-2013, 07:54 AM
Look at this link as it will do what you are wanting.

Remove selected options from dropdown list (http://www.excelforum.com/excel-general/970532-remove-selected-options-from-dropdown-list.html)

bakerman
11-29-2013, 10:46 AM
Been playing around a little. Check if this suits your needs.
Several questions have to be answered yet but this gives you a general idea.