Combo box tomfoolery

Crispie38

Registered User.
Local time
Today, 17:06
Joined
Jun 26, 2006
Messages
15
Morning

Was wondering if it was at all possible to add an option on the bottom of a combo box selection that would bring up a new window to add something to the list.
For example: I have a list of users, if I want to add to that list of users I would very much like to have an "add user" option at the bottom of the list.
e.g.
Me
You
Him
Her
add new user

Any ideas.
Thanks
Me
 
there is a not in list event for just this sort of requirement
 
I'd just have a button beside the box that adds the person. Don't ask me how to do it though.
 
You could have a table in the DB which would be a list of users.

Then in the click event of the above mentioned command button, or in even in the click event of the combo box itself open the table (by macro or code) used for user names for which the combo box has as its rowsource

Code:
DoCmd.OpenTable "tblUsers", acViewNormal, acAdd

Add the new name

Close the table

Then requery

Code:
Me.Requery

Haven't tested but gives the general idea.
HTH
 
Last edited:
You could have a table in the DB which would be a list of users.

Then in the click event of the above mentioned command button, or in even in the click event of the combo box itself open the table
You should NOT, I repeat should NOT be accessing the tables directly for data entry or editing. You do not have control over what happens when you let users access the tables directly. Conversely, you do have lots of control to ensure that they do what you want by using forms with which you can set validation code, force certain conditions to be true before continuing, etc.

Personally, I just use a small command button with a plus sign next to the combo box to open a form that lets me capture the new information and then requeries the combo box when it closes - Forms!YourFormNameHere.YourComboBoxNameHere.Requery
 
My bad...

Code:
DoCmd.OpenForm "myUserNameTableCauseIShouldntEverEverEverUseTheTableDirectlyInputForm", acNormal

Like everything in life there is a kagillion ways to do everything. I think the point was to give the inquisitor a few ideas of how to access whatever fed the combobox... :D
 
in the combo box you want to set the limit to list property as false, and then then use the not in list event to offer the option of adding a new item

(or but a button alongside)

as bob says you ought to manage the table via a form, not directly - unless of course the app is just for you and you know what you want to do
 

Users who are viewing this thread

Back
Top Bottom