Event triggering incorrectly

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • christinamasalha
    New Member
    • Jan 2007
    • 16

    Event triggering incorrectly

    hello all,

    I've been trying to figure this out for days but i don't know what the problem is. I have this form which contains 2 subforms on it. On one of the subforms there is a fields called "Range" which has an "OnGotFocus " event on it. My problem is that when i click on the first field in the subform (not Range), the Range field's OnGotFocus event is triggering. Does anybody have any idea what the problem might be?

    Thanks in advance,
    Christina
  • christinamasalha
    New Member
    • Jan 2007
    • 16

    #2
    hello all,

    I've been trying to figure this out for days but i don't know what the problem is. I have this form which contains 2 subforms on it. On one of the subforms there is a fields called "Range" which has an "OnGotFocus " event on it. My problem is that when i click on the first field in the subform (not Range), the Range field's OnGotFocus event is triggering. Does anybody have any idea what the problem might be?

    Thanks in advance,
    Christina

    Hello again everyone,

    Since i havent gotten any replies im guessing maybe my question isnt clear. I will give it another go. My problem is that i have an "OnGotFocus " event for a field called "Range" triggering, when i give focus to the subform the field is on, instead of when focus is giving to the field itself.

    Any ideas what's going on?

    Thanks again,
    Christina

    Comment

    • missinglinq
      Recognized Expert Specialist
      • Nov 2006
      • 3533

      #3
      A form, and hence a subform, can only receive focus if

      1) It has no controls on it that can receive focus

      2) It has controls on it that can receive focus but they are all disabled

      Otherwise, when you "set focus" on a form, the focus is actually set on the first control (what you call a field) of the form, in this case, apparently, a control named Range, and hence the GotFocus event is being triggered.

      Comment

      • christinamasalha
        New Member
        • Jan 2007
        • 16

        #4
        Originally posted by missinglinq
        A form, and hence a subform, can only receive focus if

        1) It has no controls on it that can receive focus

        2) It has controls on it that can receive focus but they are all disabled

        Otherwise, when you "set focus" on a form, the focus is actually set on the first control (what you call a field) of the form, in this case, apparently, a control named Range, and hence the GotFocus event is being triggered.

        Thanks for you response,
        I get what your saying but the problem is that the field range is not the first control.....the event is getting triggered when i click on the actuall first control which is a field named "Farm".

        i would really appreciate any help with this.
        Thanks,
        Christina

        Comment

        • Rabbit
          Recognized Expert MVP
          • Jan 2007
          • 12517

          #5
          Have you tried renaming Range? You'd have to rename the Sub in the code as well.

          Comment

          • missinglinq
            Recognized Expert Specialist
            • Nov 2006
            • 3533

            #6
            Clicking on a control named Farm and having the GotFocus event for a control named Ranch triggered makes no sense! First thing I'd do is doublecheck the code behind events for both of these controls, to make sure that you haven't typed in one name when you meant the other; we've all done this at one time or the other. The next thing to consider, as always when things go completely haywire, is that your form/db has been corrupted. You might want to try the old "create a blank db and import all objects into it" routine to see if that resolves the problem.

            Comment

            • christinamasalha
              New Member
              • Jan 2007
              • 16

              #7
              Originally posted by missinglinq
              Clicking on a control named Farm and having the GotFocus event for a control named Ranch triggered makes no sense! First thing I'd do is doublecheck the code behind events for both of these controls, to make sure that you haven't typed in one name when you meant the other; we've all done this at one time or the other. The next thing to consider, as always when things go completely haywire, is that your form/db has been corrupted. You might want to try the old "create a blank db and import all objects into it" routine to see if that resolves the problem.

              Thanks alot for your help, i went throught all of the code related to the range field and found that i had typed in the wrong field name like you said.....Cant believe i did that. All is working now :)

              Thanks again for all your help,
              Christina

              Comment

              • missinglinq
                Recognized Expert Specialist
                • Nov 2006
                • 3533

                #8
                As I said above, we've all done it before!! Glad you got it sorted out!

                Comment

                Working...