Link to home
Start Free TrialLog in
Avatar of Lawrence Salvucci
Lawrence SalvucciFlag for United States of America

asked on

NotInList Not working properly

I have a combo box on my form with the "NotInList" event firing this code:

    If MsgBox("Do you want to add this OWNER to the list?", vbYesNo) = vbYes Then
        DoCmd.OpenForm "frmOwnerAdd", , , , acFormAdd, acDialog, NewData
        Response = acDataErrAdded
    Else
        Response = acDataErrContinue
    End If

Open in new window


I've used this code many times in the past but for some reason after they close the pop-up form to enter the new owner into the table I get the "The text you entered isn't an item in the list" error. Then when you open the pull down on the combo you can clearly see that entry in the list. I have other databases that use this exact function and work fine. The combo box is bound to column 1 which is a "number" datatype. What also happens is after you click ok on the error message and then select the new entry from the pull down list and then tab out of that control the field goes blank but when you close and open the form the value is there. Something funky is going on and I can't figure it out. What am I missing?
Avatar of mbizup
mbizup
Flag of Kazakhstan image

Your code and method seem to be working fine for me.  The issue might be in your dialog box rather than the code you posted here.

Can you post a sample database with just the relevant forms/queries/tables showing this issue?  Strip it of any sensitive data or features before posting it.
ASKER CERTIFIED SOLUTION
Avatar of Jim Dettman (EE MVE)
Jim Dettman (EE MVE)
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
BTW, what's the rowsource of the combo?  Query/table or SQL statement your building on the fly?

Jim.
what version of access are you using?
Avatar of Lawrence Salvucci

ASKER

Sorry for the delay in posting back. I did a /decompile and that worked. Something must have been getting hung up somewhere but all is well now. Thank you for the quick responses.