[Access 2003] problems with combobox-control and on_change

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Horst JENS

    #1

    [Access 2003] problems with combobox-control and on_change

    Hi group,
    have problems with combobox-control in a form (access 2003).
    I added VBA-Code to on-Change event of the control. If the user choose an
    value from the control, the filter of the form change to that value.

    so far it works.

    problem is, it only works if the user change the (value of the) control
    with the mouse. As soon as he starts pressing the keyboard, i get errors.

    First i get the usual "Item not in list" messagebox but then i get an
    error from the filter to. (trying to apply an useless filter).

    Is there an way to check if the control has an useful value at the moment
    or if the user is still typing in keys ? I want to fire the
    on-change-event of the control only if the value of the control is an
    value of it's control-source query.

    I try the OnNotInList Function but got nowhere. Can you enlighten me
    what to try next ?

    thanks,
    -Horst
  • Len Robichaud

    #2
    Re: [Access 2003] problems with combobox-control and on_change

    The OnChange event, by design, triggers as soon as the first key is pressed
    (or a choice is made with a mouse). In other words, as soon as the value
    begins to change this event fires.
    If you want to be sure the value the user enters is only from the combo
    box's record source, set the combobox LimitToList property to Yes. This
    will stop the user from entering an invalid choice.
    Once the choice has been picked (or entered), If you want to then take some
    action based on the user's choice, use the AfterUpdate Event.


    "Horst JENS" <horst.jens@che llo.atwrote in message
    news:7ce2e$46bf ea38$54729557$2 0295@news.chell o.at...
    Hi group,
    have problems with combobox-control in a form (access 2003).
    I added VBA-Code to on-Change event of the control. If the user choose an
    value from the control, the filter of the form change to that value.

    so far it works.

    problem is, it only works if the user change the (value of the) control
    with the mouse. As soon as he starts pressing the keyboard, i get errors.

    First i get the usual "Item not in list" messagebox but then i get an
    error from the filter to. (trying to apply an useless filter).

    Is there an way to check if the control has an useful value at the moment
    or if the user is still typing in keys ? I want to fire the
    on-change-event of the control only if the value of the control is an
    value of it's control-source query.

    I try the OnNotInList Function but got nowhere. Can you enlighten me
    what to try next ?

    thanks,
    -Horst


    Comment

    • Horst JENS

      #3
      Re: [Access 2003] problems with combobox-control and on_change

      On Mon, 13 Aug 2007 08:45:20 -0400, Len Robichaud wrote:
      The OnChange event, by design, triggers as soon as the first key is pressed
      (or a choice is made with a mouse). In other words, as soon as the value
      begins to change this event fires.
      If you want to be sure the value the user enters is only from the combo
      box's record source, set the combobox LimitToList property to Yes. This
      will stop the user from entering an invalid choice.
      Once the choice has been picked (or entered), If you want to then take some
      action based on the user's choice, use the AfterUpdate Event.

      This worked great !
      Thanks a lot !

      -Horst

      Comment

      Working...