Access -- dropdown list OR "Add New"
November 18, 2022 9:41 AM   Subscribe

I'm actually making good progress in recreating my previous setup in Access However, there's one thing I'd like to be able to do that I suspect is possible but I don't know how: Where I have a linked field (so you get a dropdown menu based on values from a field in another table), I want to have one of the options be "Add New" so you can type in something not already in the other table. I then want that thing to appear in the other table (and yes, I realize some fields for that row will be initially blank). How can I do this?

So for example, I'd i'm on a primarily projects-based form and I want to add the people associated with the project, I want a dropdown list with the people I already have, but I want to be able to add-new and then there will be a row with the person's name in the people table.
posted by If only I had a penguin... to Computers & Internet (4 answers total)
 
I'm a little rusty with Access but there should be a "Limit to list" property for the combo box. Set it to false, then on the AfterUpdate event for the combo box use VBA to run a "INSERT INTO [your person table]" statement. You can MeMail me if you need more detailed instructions.
posted by mezzanayne at 10:40 AM on November 18


Response by poster: Is this in the table creation? I'm definitely not seeing any option to limit or not. It just limits. Theres an option to select multiple or not (yes, I want that one) but nothing else.
posted by If only I had a penguin... at 12:09 PM on November 18


Best answer: No, the property is in the form. Here is a page that describes the property and also provides the VBA code for adding a new record to the combo box source table.
posted by mezzanayne at 12:38 PM on November 18 [1 favorite]


Response by poster: Thank you! It took some more learning and youtube videoing to figure out where to put the code, but I did it! It's perfect. Now I need a more advanced version that can do this for columns that allow you to select multiple.
posted by If only I had a penguin... at 8:49 AM on November 22 [1 favorite]


« Older Help me find a book?   |   The world is literally my oyster: January solo... Newer »

You are not logged in, either login or create an account to post comments