I have a form frmOrder with an unbound combo box cboPartNo, with the
Limit to List property set to Yes. In the "On Not in List" event, I've added
the following:
DoCmd.OpenForm "frmNewPart", , , , , acDialog
Response = acDataErrAdded
When I enter a new part number in the combo box, the form frmNewPart opens
as expected, but when I try to close the form, I get the following message:
"The text you entered isn't an item in the list.
Select an item from the list, or enter text that matches one of the listed
items."
Then the frmNewPart form closes without updating the information in the
frmOrder form.
I've tried changing the Limit to List" property to No, but it didn't solve
the problem.
Ivor
Allen Browne - 18 Dec 2007 06:05 GMT
Which is the Bound Column of the combo?
Is this the display column?
When the combo's NotInList event fires, the NewData argument passes the
value the user typed into the combo. If this is not the value that gets
stored in the Bound Column, your approach won't work.
For example, a typical combo has properties like this:
Control Source CategoryID
RowSource SELECT CategoryID, CategoryName FROM tblCategory;
Bound Column 1
Column Widths 0
Then the user enters a new category (text), which is *not* what goes in the
CategoryID column (number.) If this is what you are doing, the NotInList
event will not work. You need to provide another mechanism for adding new
items, such as a command button beside the combo, or its DblClick event.
Access 2007 allows you to specify the form to use to add items to the
combo's source table. You can then right-click the combo to add items.

Signature
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.
> I have a form frmOrder with an unbound combo box cboPartNo, with the
> Limit to List property set to Yes. In the "On Not in List" event, I've
[quoted text clipped - 18 lines]
>
> Ivor