none
Error Trapping RRS feed

  • Question

  • Hi all,

    I am trying to trap certain application errors, for example when a combobox's "Limit to List" property is set to YES and you type anything into the combobox. The message dispalyed is

    I don't seem to be able to trap these errors.

    I want to trap this error because I want to ask the user if they would like to add the description to the reference table for future use.

    Thanks

    Deon

    Monday, October 21, 2019 2:07 PM

Answers

  • You might like to take a look at NotInList.zip in my public databases folder at:

    https://onedrive.live.com/?cid=44CC60D7FEA42912&id=44CC60D7FEA42912!169

    Note that if you are using an earlier version of Access you might find that the colour of some form objects such as buttons shows incorrectly and you will need to  amend the form design accordingly.  

    If you have difficulty opening the link, copy the link (NB, not the link location) and paste it into your browser's address bar.

    This little demo file illustrates the use of the NotInList event procedure of a combo box control, allowing the user to add an item to the list transparently where appropriate, or by opening a form in dialogue mode and passing the new value to it via the OpenArgs mechanism.  The user can then add additional data to other columns in the new record in the referenced table via the form.

    The demo also illustrates how to deal with situations where the NotInList event is inappropriate, e.g. with personal names, which can of course legitimately be duplicated.  In this case a separate command button is used to open a form to add a record for the new person, whether or not another person of the same name is already represented in the database.

    Ken Sheridan, Stafford, England

    • Marked as answer by Deon SA Tuesday, October 22, 2019 5:26 AM
    Monday, October 21, 2019 5:24 PM

All replies

  • That’s not an error, that’s how the combobox works.

    Set limit to list = no, and go from there.


    peter n roth - http://PNR1.com, Maybe some useful stuff

    Monday, October 21, 2019 2:48 PM
  • You might like to take a look at NotInList.zip in my public databases folder at:

    https://onedrive.live.com/?cid=44CC60D7FEA42912&id=44CC60D7FEA42912!169

    Note that if you are using an earlier version of Access you might find that the colour of some form objects such as buttons shows incorrectly and you will need to  amend the form design accordingly.  

    If you have difficulty opening the link, copy the link (NB, not the link location) and paste it into your browser's address bar.

    This little demo file illustrates the use of the NotInList event procedure of a combo box control, allowing the user to add an item to the list transparently where appropriate, or by opening a form in dialogue mode and passing the new value to it via the OpenArgs mechanism.  The user can then add additional data to other columns in the new record in the referenced table via the form.

    The demo also illustrates how to deal with situations where the NotInList event is inappropriate, e.g. with personal names, which can of course legitimately be duplicated.  In this case a separate command button is used to open a form to add a record for the new person, whether or not another person of the same name is already represented in the database.

    Ken Sheridan, Stafford, England

    • Marked as answer by Deon SA Tuesday, October 22, 2019 5:26 AM
    Monday, October 21, 2019 5:24 PM
  • Hi Ken,

    Thanks, this is a very helpful example and works fine.

    Regards

    Deon

    Tuesday, October 22, 2019 5:26 AM