Results 1 to 3 of 3
  1. #1
    New Lounger
    Join Date
    Oct 2005
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Not in the list (Access 2000)

    I have a combo box called CustomerID with which i use to select the customer i want.If i select a cutsomer that does not exist, then
    the folloiwng message appears:
    " The text you entered isnt an item in the list.Select an item from the list or enter text that matches one of the listed items"

    This creates me enormous problems, since the combo box stays with the name or number i have seletced and that is not in the list.
    When i click on some other control for example to exit the database, then the database get stuck.
    can you help me imrpove my combo box ? I want , when the user chooser a wrong or non existen customer, to clear the combo box
    in such a way that i have no further problems with freezing the database.How can i achieve that?

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Not in the list (Access 2000)

    You can write code in the On Not In List event of the combo box.

    Private Sub CustomerID_NotInList(NewData As String, Response As Integer)

    End Sub

    The event procedure has two arguments: NewData is the text entered by the user, and Response can be set by the programmer (you) to one of the following three values:

    acDataErrDisplay - this is the default, Access will display the standard error message "The text you entered isn't an item ..."
    acDataErrAdded - use this if you used code to add NewData to the row source of the combo box.
    acDataErrContinue - don't display an error message, for example because you displayed one yourself.

    In this situation, you could display a custom message, set Response to acDataErrContinue and undo the new value:

    Private Sub CustomerID_NotInList(NewData As String, Response As Integer)
    ' Display a custom error message
    MsgBox "This is not an existing customer!", vbExclamation
    ' Undo the new value
    CustomerID.Undo
    ' Suppress the built-in error message
    Response = acDataErrContinue
    End Sub

  3. #3
    New Lounger
    Join Date
    Oct 2005
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Not in the list (Access 2000)

    Thank you, Hans! Runs smoothly now

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •