Add items to combo box on the fly using only Macros(no VBA)

geek2016

New member
Local time
Today, 13:32
Joined
Nov 5, 2016
Messages
3
Is there a way I can allow users to add values to a combo box on the fly using only macros? I've got Access 2013. I know to set the limit2list property to No and use the NotInList event. But not sure what macro combination would do the trick.
 
What is the row source of this combo box? If the row source type is a value list, and the Allow Value List Edits property is set to Yes then user can just right click on the combo box to add values.
 
The row source is a select list from a table. I read somewhere that the table itself doesn't get updated unless you do something specific to make that happen.
 
The row source is a select list from a table. I read somewhere that the table itself doesn't get updated unless you do something specific to make that happen.
That's correct. You could do an INSERT INTO in the Not In list event which is pretty simple in VBA but I don't think it's easy to do in a macro. I suppose you might be able to assign the value of the combo box to a TempVar and then put that in an append query that would be opened by the macro.

Edit: Rather than use a TempVar you could use a reference (e.g., FORMS![TheFormName]![TheComboBoxName]) in the amend query if the value to be inserted is the bound column.

Why are you restricted to macros? Homework assignment?
 
Last edited:
normally youd run an append query.
then refresh the box.
 
Why use macros? I was hoping to make this as simple (and generic) as possible - as there are a lot of dropdown lists.

So, it sounds like i'll need VBA. Not a major issue.

The tables have and ID and Text field. The combo boxes are bound to the ID, but show the text. The database contains a lot of repeated references to the same large text fields, so it makes sense to store the IDs rather than the text itself in each record.

So, what's the simplest way to do this in VBA so that the user keys in a new text value and the value is selected in the drop-down.
 

Users who are viewing this thread

Back
Top Bottom