Solved

NotInList Not working properly

Posted on 2013-11-05
5
309 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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 120

Expert Comment

by:Rey Obrero (Capricorn1)
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

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes two methods for creating a combo box that can be used to add new items to the row source -- one for simple lookup tables, and one for a more complex row source where the new item needs data for several fields.
The Windows Phone Theme Colours is a tight, powerful, and well balanced palette. This tiny Access application makes it a snap to select and pick a value. And it doubles as an intro to implementing WithEvents, one of Access' hidden gems.
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

739 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