NotInLest Event

access United States
  • 15 years ago

    Hi Guys,


    I'm trying on the NotInList event in combobox. my combox contain ID Numbers.


    when I'm entering a new ID in the combobox it


    doesn't allow it. I have read that I can do


    that using the NotInList event and I found a


    code for it. but it's doesn't work.


    Does anyone know a code that works?


    following you can find the code that I have


    used:
    http://support.microsoft.com/default.aspx?scid


    =kb;en-us;197526


    this is the part that I have problem with:
    [COLOR=DarkRed][B]   ' Look for the customer


    the user created in the Customers form.
       Result = DLookup("[CompanyName]", "


    Customers", _
                "[CompanyName]='" & NewData & "'")
       If IsNull(Result) Then
          ' If the customer was not created, set


    the Response argument
          ' to suppress an error message and undo


    changes.
          Response = acDataErrContinue
          ' Display a customized message.
          MsgBox "Please try again!"
       Else
          ' If the customer was created, set the


    Response argument to
          ' indicate that new data is being added.
          Response = acDataErrAdded
       End If[/B][/COLOR]


    my problem :
    when I enter a new ID it asks me if I want to


    add it to the combobox. however when I click on


    Yes it gives me the "Please try again!"


    message.


    Any help will be very much appreciated!


    Regards,
    CS.

Post a reply

No one has replied yet! Why not be the first?

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“Walking on water and developing software from a specification are easy if both are frozen.” - Edward V Berard