5 Replies Latest reply on Sep 4, 2013 7:29 AM by philmodjunk

    Open at last record viewed

    Mitch

      Title

      Open at last record viewed

      Post

           Hi,

           I have a database that allows users to 'Archive' a record by placing the value 'Archived' in a field.

           Open next open, the database will perform a find of all records where the value in this field does not equal 'Archived'.  Leaving the found set showing only un archived records.  This woks well enought, but when the database opens it always opens at the first record in the found set, being the oldest record.

           How can I keep the archiving function and have the datbase open at the last record that was viewed before shutdown.

           Mitch

        • 1. Re: Open at last record viewed
          philmodjunk

               Does this database have only one user? Otherwise the "last record viewed" will be different for every user. And in some database designs, that "last record" could even be from more than one table on more than one layout.

          • 2. Re: Open at last record viewed
            Mitch

                 Hi,

                  

                 The database has one user only and has a close script the ensures it closes from the main layout (most of the time anyway).

            • 3. Re: Open at last record viewed
              philmodjunk

                   Which doesn't address this issue:

                   

                        And in some database designs, that "last record" could even be from more than one table on more than one layout.

                   If this is a single user database and it is not hosted from another computer, have your OnLastWindowClose script set a global field to the current record's primary key.

                   Then your script that performs when the file opens can loop through the found set of records until the primary key of the current record matches that of the primary key saved to the global field.

              • 4. Re: Open at last record viewed
                Mitch

                     Phil,

                     I assume that when I archive a record, after which a new find is performed for not archived records. That found set remains until close.  When I re-start the databse, the found set should remain?   Therefore there is no need for a find of non archived records on start, which cases the database open at record number 1.

                     Mitch

                • 5. Re: Open at last record viewed
                  philmodjunk

                       There are factors that can affect that--performing the find in a different window or on a different layout based on a different occurrence of the same table come to mind, but that is essentially correct for cases where the database is not hosted over a network.