Prohibit record navigation

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

    #1

    Prohibit record navigation

    Hi

    I need to block user from moving away from a record using any of
    First/Last/Prev/Next/New Record or any other way IF the record has not been
    saved, and displaying a message to the effect "Please finish editing". If
    however the user has explicitly saved the record using save from the access
    menu then allow to move from record. How do I achieve this via code?

    Thanks

    Regards


  • pietlinden@hotmail.com

    #2
    Re: Prohibit record navigation

    One way is to set the Required property of all the fields in the
    underlying table to True. Then the user won't be able to leave the
    record without filling out all the fields.

    Comment

    • Bob Quintal

      #3
      Re: Prohibit record navigation

      "John" <John@nospam.in fovis.co.uk> wrote in
      news:PqednQWfv5 s20RLZRVnyvw@pi pex.net:
      [color=blue]
      > Hi
      >
      > I need to block user from moving away from a record using any
      > of First/Last/Prev/Next/New Record or any other way IF the
      > record has not been saved, and displaying a message to the
      > effect "Please finish editing". If however the user has
      > explicitly saved the record using save from the access menu
      > then allow to move from record. How do I achieve this via
      > code?
      >
      > Thanks
      >
      > Regards
      >[/color]
      First, let me suggest a better way. In the BeforeUpdate of your
      form, you need to put validation statements for each control
      that is required. If it fails the test, cancel the update, and
      give your error message.

      example:
      if isnull(me.lastn ame) then
      cancel = true
      msgbox "Last Name is a required Field." & vbnewline _
      & "You must enter a last name!, vbOkOnly
      end if

      To do what you want, you must do exactly the same things, and
      also remove the built-in navigation controls from the form,
      replacing them with your own. You would also need to enable and
      disable these controls based on the status of whether the record
      was dirty (had unsaved edits) or not.

      --
      Bob Quintal

      PA is y I've altered my email address.

      --
      Posted via a free Usenet account from http://www.teranews.com

      Comment

      • John

        #4
        Re: Prohibit record navigation

        Problem is not so much to fill all fields but to discourage moving to
        another record by mistake by pressing one of the navigation buttons and then
        not being able to find the original record or worst overwrite over an
        exiting record. We get a lot of temp staff who need to enter their own info
        and they tend to make a lot of mistakes hence the need to restrict. However
        if the record has been explicitly saved buy the user then it is an
        indication that user knows that he/she has finished. In which case they are
        allowed to navigate.

        Thanks

        "Bob Quintal" <rquintal@sPAmp atico.ca> wrote in message
        news:Xns97E1CEB A97A96BQuintal@ 66.150.105.47.. .[color=blue]
        > "John" <John@nospam.in fovis.co.uk> wrote in
        > news:PqednQWfv5 s20RLZRVnyvw@pi pex.net:
        >[color=green]
        >> Hi
        >>
        >> I need to block user from moving away from a record using any
        >> of First/Last/Prev/Next/New Record or any other way IF the
        >> record has not been saved, and displaying a message to the
        >> effect "Please finish editing". If however the user has
        >> explicitly saved the record using save from the access menu
        >> then allow to move from record. How do I achieve this via
        >> code?
        >>
        >> Thanks
        >>
        >> Regards
        >>[/color]
        > First, let me suggest a better way. In the BeforeUpdate of your
        > form, you need to put validation statements for each control
        > that is required. If it fails the test, cancel the update, and
        > give your error message.
        >
        > example:
        > if isnull(me.lastn ame) then
        > cancel = true
        > msgbox "Last Name is a required Field." & vbnewline _
        > & "You must enter a last name!, vbOkOnly
        > end if
        >
        > To do what you want, you must do exactly the same things, and
        > also remove the built-in navigation controls from the form,
        > replacing them with your own. You would also need to enable and
        > disable these controls based on the status of whether the record
        > was dirty (had unsaved edits) or not.
        >
        > --
        > Bob Quintal
        >
        > PA is y I've altered my email address.
        >
        > --
        > Posted via a free Usenet account from http://www.teranews.com
        >[/color]


        Comment

        • pietlinden@hotmail.com

          #5
          Re: Prohibit record navigation

          In that case, you could put a messagebox in your code in the
          BeforeUpdate <?> or the last event that fires in the form before going
          to the next record or closes the form. If you don't want to
          move/close, set Cancel=True and pop up a messagebox alerting the user.

          Comment

          • rkc

            #6
            Re: Prohibit record navigation

            John wrote:[color=blue]
            > Problem is not so much to fill all fields but to discourage moving to
            > another record by mistake by pressing one of the navigation buttons and then
            > not being able to find the original record or worst overwrite over an
            > exiting record.[/color]

            The safest way is to not allow edit/entry in the same form
            that is used to browse records. Enter/edit records in another
            form bound to a single record or opened for new entry only.

            Comment

            • Bob Quintal

              #7
              Re: Prohibit record navigation

              "John" <John@nospam.in fovis.co.uk> wrote in
              news:xOWdnROwN7 V5xxLZnZ2dnUVZ8 s6dnZ2d@pipex.n et:
              [color=blue]
              > Problem is not so much to fill all fields but to discourage
              > moving to another record by mistake by pressing one of the
              > navigation buttons and then not being able to find the
              > original record or worst overwrite over an exiting record. We
              > get a lot of temp staff who need to enter their own info and
              > they tend to make a lot of mistakes hence the need to
              > restrict. However if the record has been explicitly saved buy
              > the user then it is an indication that user knows that he/she
              > has finished. In which case they are allowed to navigate.
              >
              > Thanks[/color]

              My usual design for the user interface involves a continuous
              form that's read only, showing the major details of each record.
              The form has two buttons, "Add new" and "Edit This". Clicking on
              these buttons open single record forms with no navigation
              controls. Each has a "Save and Exit" button, and a "Cancel and
              Exit" one. Even your average LUSER can figure out operation
              easily, and it overcomes the problem you have. I never let the
              user edit a record in a continuous form (*), and I do not ever
              let them create a new record in a continuous form.

              (*)except in very special circumstances, like a form with
              checkboxes to select records for further processing.
              [color=blue]
              >
              > "Bob Quintal" <rquintal@sPAmp atico.ca> wrote in message
              > news:Xns97E1CEB A97A96BQuintal@ 66.150.105.47.. .[color=green]
              >> "John" <John@nospam.in fovis.co.uk> wrote in
              >> news:PqednQWfv5 s20RLZRVnyvw@pi pex.net:
              >>[color=darkred]
              >>> Hi
              >>>
              >>> I need to block user from moving away from a record using
              >>> any of First/Last/Prev/Next/New Record or any other way IF
              >>> the record has not been saved, and displaying a message to
              >>> the effect "Please finish editing". If however the user has
              >>> explicitly saved the record using save from the access menu
              >>> then allow to move from record. How do I achieve this via
              >>> code?
              >>>
              >>> Thanks
              >>>
              >>> Regards
              >>>[/color]
              >> First, let me suggest a better way. In the BeforeUpdate of
              >> your form, you need to put validation statements for each
              >> control that is required. If it fails the test, cancel the
              >> update, and give your error message.
              >>
              >> example:
              >> if isnull(me.lastn ame) then
              >> cancel = true
              >> msgbox "Last Name is a required Field." & vbnewline _
              >> & "You must enter a last name!, vbOkOnly
              >> end if
              >>
              >> To do what you want, you must do exactly the same things, and
              >> also remove the built-in navigation controls from the form,
              >> replacing them with your own. You would also need to enable
              >> and disable these controls based on the status of whether the
              >> record was dirty (had unsaved edits) or not.
              >>
              >> --
              >> Bob Quintal
              >>
              >> PA is y I've altered my email address.
              >>
              >> --
              >> Posted via a free Usenet account from http://www.teranews.com
              >>[/color]
              >
              >[/color]



              --
              Bob Quintal

              PA is y I've altered my email address.

              --
              Posted via a free Usenet account from http://www.teranews.com

              Comment

              Working...