Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Adding new data to a combo box

Status
Not open for further replies.

smc

Technical User
Mar 13, 2000
3
US
I have two bound combo boxes. I limit the list in the second one based on selections in the first, no big deal right?&nbsp;&nbsp;My problem is trying to add new data to the second combo box &quot;on the fly&quot;, in other words, dynamically without having to go to a popup form.&nbsp;&nbsp;Apparently, because of the query to &quot;limit the list&quot;, I am unable to get the &quot;not in list&quot; event to accept new data.&nbsp;&nbsp;I have a work around that involves hiding and showing fields, but it is slow and awkward.<br>If someone has experienced this problem I would much appreciate your solution.<br>Thanks in advance<br>(Using Access97)
 
Hmm. I'm a bit confused about how you're doing it. But if choosing something in the first combo box changes the rowsource for the second, then I think adding shouldn't be hard. The documentation is confusing, but this is what I've puzzled out.<br><br>Mark the second combobox as &quot;limit to list&quot; in order mainly to let it move through the list as the user types. When the entered value is not in the list and the user tabs out, the &quot;not in list&quot; event fires. From that event you can put code to either add the new record to the combo's recordsource or verify adding. If you've added a new record, then you must change the value of the &quot;Response&quot; parameter for the event. If you change it to the constant &quot;acDataErrContinue&quot; (I think that's what it's called), then Access passes out of the event without raising an error, requeries the combobox, and since the record's been added, finds the selection.<br><br>I hope this is what you were looking for.<br>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top