Solved

NotInList Not working properly

Posted on 2013-11-05
5
303 Views
Last Modified: 2013-11-05
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?
0
Comment
Question by:Lawrence Salvucci
5 Comments
 
LVL 61

Expert Comment

by:mbizup
ID: 39623970
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.
0
 
LVL 57

Accepted Solution

by:
Jim Dettman (Microsoft MVP/ EE MVE) earned 500 total points
ID: 39623996
I don't see anything wrong either.   I would do a /decompile first (which is a command line switch).

That will cleanout the compiled code (do a backup first).  Also do a compile and make sure your error free after that.

Details can be found here:

http://www.experts-exchange.com/Microsoft/Development/MS_Access/A_2043-Decompile-What-it-is-what-it-does-and-how-to-use-it.html

Jim.
0
 
LVL 57
ID: 39623997
BTW, what's the rowsource of the combo?  Query/table or SQL statement your building on the fly?

Jim.
0
 
LVL 119

Expert Comment

by:Rey Obrero
ID: 39624233
what version of access are you using?
0
 
LVL 1

Author Comment

by:Lawrence Salvucci
ID: 39626022
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.
0

Featured Post

Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Join & Write a Comment

In the article entitled Working with Objects – Part 1 (http://www.experts-exchange.com/Microsoft/Development/MS_Access/A_4942-Working-with-Objects-Part-1.html), you learned the basics of working with objects, properties, methods, and events. In Work…
Regardless of which version on MS Access you are using, one of the harder data-entry forms to create is one where most data from previous entries needs to be appended to new records, especially when there are numerous fields and records involved.  W…
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now