Change tab key behavior to NOT trigger combobox BeforeUpdate event ?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • elturbo3
    New Member
    • Dec 2012
    • 14

    Change tab key behavior to NOT trigger combobox BeforeUpdate event ?

    I have a form with a BeforeUpdate event that populates other text fields when the user makes a selection in a combobox.

    I want the user to be able to enter new text into the combobox and tab to the next field without triggering the event. It seems the tab key press triggers the event as well as a selection in the combobox.

    Any ideas?
  • Rabbit
    Recognized Expert MVP
    • Jan 2007
    • 12517

    #2
    You can't prevent it from firing but you can prevent it from running the other code by first checking if the value they entered is in the list of values.

    Comment

    • elturbo3
      New Member
      • Dec 2012
      • 14

      #3
      Thanks for the reply Rabbit.

      The user will likely open the combobox to see if their selection is available. If it is not available then they will begin typing. Is there a way to code the event so that if the user types input then it doesn't trigger the event?

      I'm using last names so on occasion I get last names that are the in the list but not the correct person and address.

      Comment

      • elturbo3
        New Member
        • Dec 2012
        • 14

        #4
        When the user enteres a last name that is in the list then the combobox automatically selects that record and populates the rest of the forms field. The user needs to be able to type a new record without the autofill.

        Comment

        • slenish
          Contributor
          • Feb 2010
          • 283

          #5
          You could do what you need in a few different ways.

          1. Create a new form that is for user entry.
          2. Change the beforeUpdate event to DoCmd.GoToRecor d , , acNewRec
          3. Remove the BeforeUpdate event so it does not trigger the auto fill action.

          Comment

          • Rabbit
            Recognized Expert MVP
            • Jan 2007
            • 12517

            #6
            The answer to your question is the same as my original answer.

            Comment

            • elturbo3
              New Member
              • Dec 2012
              • 14

              #7
              Would you mind showing me how to do that?

              Comment

              • elturbo3
                New Member
                • Dec 2012
                • 14

                #8
                Thanks for thinking about this Rabbit. I think I solved this particular problem by adding an command button that executes the code to propogate my text fields. This way they can type free hand or choose a record from the combobox. I suppose it could be coded better to remove the need to click the command button but this seems to work. I do have another question related to this same topic but I suppose I will start a new thread.

                Comment

                • Rabbit
                  Recognized Expert MVP
                  • Jan 2007
                  • 12517

                  #9
                  You would implement my suggestion by doing this:
                  Code:
                  If [the value of he combo box is in the list of values] Then
                     execute the rest of your code
                  End If
                  That is pseudocode, the actual code will differ but the logic will be the same.

                  There's no need to create an extra step for them by requiring them to click a button.

                  Comment

                  Working...