Problem with AfterUpdate event

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

    #1

    Problem with AfterUpdate event

    I'm developing an unbound form with a series of questions on it. Each
    question is either a text box or an option group. I have coding in the
    AfterUpdate event of each control to highlight the next question to be
    answered, as a visual cue for the user. After the user has answered
    all questions, they click on the "Save" button to save their answers.

    My problem is that they have to click on "Save" twice because the
    AfterUpdate event fires on the last control they input into. The next
    question is highlighted then the user has to click on "Save" again.

    Is there a way to get around this? Btw, I'm using 2003. Thanks in
    advance for any help or advice.

  • Allen Browne

    #2
    Re: Problem with AfterUpdate event

    That sounds like a really complicated way to design a form. Sounds like you
    are providing controls for every question and every answer. If there's more
    than 3 or 4 questions, this is going to be very time consuming to build, and
    difficult to maintain.

    You might like to look at this sample database by Duane Hookom. It
    illustrates how to build a survey/questionaire type database:
    http://www.rogersacces slibrary.com/Otherdownload.a sp?SampleName=' At%20Your%20Sur vey%202000'

    The answer to your immediate question will be to remove the code from the
    AfterUpdate of the control, and use the Tab Order of the form (View menu) to
    define where the focus goes to after that question.

    Alternatively, if the survery jumps around lots, you could add a small
    (nearly invisible) text box, and SetFocus to that when the last question is
    done. In its Enter event, SetFocus to your Save command button. (This is
    assuming you can't just SetFocus to the Save button from each of the exit
    points.)

    --
    Allen Browne - Microsoft MVP. Perth, Western Australia
    Tips for Access users - http://allenbrowne.com/tips.html
    Reply to group, rather than allenbrowne at mvps dot org.

    "EManning" <manning_news@h otmail.comwrote in message
    news:1165442566 .205604.184740@ f1g2000cwa.goog legroups.com...
    I'm developing an unbound form with a series of questions on it. Each
    question is either a text box or an option group. I have coding in the
    AfterUpdate event of each control to highlight the next question to be
    answered, as a visual cue for the user. After the user has answered
    all questions, they click on the "Save" button to save their answers.
    >
    My problem is that they have to click on "Save" twice because the
    AfterUpdate event fires on the last control they input into. The next
    question is highlighted then the user has to click on "Save" again.
    >
    Is there a way to get around this? Btw, I'm using 2003. Thanks in
    advance for any help or advice.

    Comment

    • ManningFan

      #3
      Re: Problem with AfterUpdate event

      Why not use code on the last AfterUpdate to check to see if it's being
      fired by the button? I would think you can put a tag value on the
      button and then check the value of the active tag, or something along
      those lines.

      EManning wrote:
      I'm developing an unbound form with a series of questions on it. Each
      question is either a text box or an option group. I have coding in the
      AfterUpdate event of each control to highlight the next question to be
      answered, as a visual cue for the user. After the user has answered
      all questions, they click on the "Save" button to save their answers.
      >
      My problem is that they have to click on "Save" twice because the
      AfterUpdate event fires on the last control they input into. The next
      question is highlighted then the user has to click on "Save" again.
      >
      Is there a way to get around this? Btw, I'm using 2003. Thanks in
      advance for any help or advice.

      Comment

      • EManning

        #4
        Re: Problem with AfterUpdate event

        You're right about it being complicated. I considered Duane Hookom's
        solution before I started this project. It wasn't visually-pleasing
        enough for my customer however. There are about 20 questionnaires so
        as long as they're willing to pay me for my time, then I'll give them
        what they want.

        Thanks for your reply.



        Allen Browne wrote:
        That sounds like a really complicated way to design a form. Sounds like you
        are providing controls for every question and every answer. If there's more
        than 3 or 4 questions, this is going to be very time consuming to build, and
        difficult to maintain.
        >
        You might like to look at this sample database by Duane Hookom. It
        illustrates how to build a survey/questionaire type database:
        http://www.rogersacces slibrary.com/Otherdownload.a sp?SampleName=' At%20Your%20Sur vey%202000'
        >
        The answer to your immediate question will be to remove the code from the
        AfterUpdate of the control, and use the Tab Order of the form (View menu) to
        define where the focus goes to after that question.
        >
        Alternatively, if the survery jumps around lots, you could add a small
        (nearly invisible) text box, and SetFocus to that when the last question is
        done. In its Enter event, SetFocus to your Save command button. (This is
        assuming you can't just SetFocus to the Save button from each of the exit
        points.)
        >
        --
        Allen Browne - Microsoft MVP. Perth, Western Australia
        Tips for Access users - http://allenbrowne.com/tips.html
        Reply to group, rather than allenbrowne at mvps dot org.
        >
        "EManning" <manning_news@h otmail.comwrote in message
        news:1165442566 .205604.184740@ f1g2000cwa.goog legroups.com...
        I'm developing an unbound form with a series of questions on it. Each
        question is either a text box or an option group. I have coding in the
        AfterUpdate event of each control to highlight the next question to be
        answered, as a visual cue for the user. After the user has answered
        all questions, they click on the "Save" button to save their answers.

        My problem is that they have to click on "Save" twice because the
        AfterUpdate event fires on the last control they input into. The next
        question is highlighted then the user has to click on "Save" again.

        Is there a way to get around this? Btw, I'm using 2003. Thanks in
        advance for any help or advice.

        Comment

        • EManning

          #5
          Re: Problem with AfterUpdate event

          Thanks for your reply. I'll give this some more thought. I'm not sure
          how to make this work right now. I would have to put this code in
          every AfterUpdate event because not every question has to be answered
          so there's no telling what the last AfterUpdate event would be.



          ManningFan wrote:
          Why not use code on the last AfterUpdate to check to see if it's being
          fired by the button? I would think you can put a tag value on the
          button and then check the value of the active tag, or something along
          those lines.
          >
          EManning wrote:
          I'm developing an unbound form with a series of questions on it. Each
          question is either a text box or an option group. I have coding in the
          AfterUpdate event of each control to highlight the next question to be
          answered, as a visual cue for the user. After the user has answered
          all questions, they click on the "Save" button to save their answers.

          My problem is that they have to click on "Save" twice because the
          AfterUpdate event fires on the last control they input into. The next
          question is highlighted then the user has to click on "Save" again.

          Is there a way to get around this? Btw, I'm using 2003. Thanks in
          advance for any help or advice.

          Comment

          • pietlinden@hotmail.com

            #6
            Re: Problem with AfterUpdate event


            you might want to read this post...



            Comment

            Working...