Strategy for handling two separate queries/recordsets in Access

I'm looking for input as to how to best implement some required business functionality in MS Access.  (Environment details below)

From a form, a user needs to browse and edit rows in a table. There are two modes they can operate in:  1. Browse ALL, and 2. Browse Unprocessed (or "raw").

While in Browse ALL,  all rows are visible. Any row can be edited and updates saved.  When saved, userid and date/timestamp are saved into two columns of the row (USER_SAVE, and SAVE_DT). If the table has 100 rows, all 100 are visible and available for update.

In Browse Unprocessed mode, only a subset of the data is visible and available .. only those rows which have not been edited and saved before (i.e. USER_SAVE and SAVE_DT both NULL).

Users switch between these modes via radio buttons on the form.  When they switch, the following must occur:

1. switching from Browse Unprocessed to Browse ALL - the position within the table remains the same, i.e. if row ID=32546 was the current record in Browse Unprocessed mode, it will remain the current row once switched to Browse ALL mode.

2. switching from Browse ALL to Browse Unprocessed - if the current row is Unprocessed, it remains the current row after the switch.  If the current row has been processed, then the next unprocessed row will become the current row, i.e. current row ID=32544 has been processed, and so has ID=32545, while ID=32546 has not been processed.  When the mode is switched, row ID=32546 should become the current row.

Those are the business requirements. Here are the approaches/strategies I've considered and toyed with.  My inexperience with MS Access leaves me not knowing what approach is best suited.  Considerations are ..
simplest to implement and maintain,
least likely to have unforeseen side effects,
is aligned with most common approaches.

I created the form with Access GUI, so fields were bound to the underlying recordset, which was handled under the covers by Access.  I was uncertain how to create the subset of rows needed for the Browse Unprocessed mode.

One approach was to apply a filter to create the subset.
    DoCmd.ApplyFilter whereCondition:=sSQL

Open in new window

(I know this isn't applied to the recordset, because setting rst.Filter only takes effect for a second recordset that's created from the first with Filter defined. The question is, what object is the ApplyFilter method invoked on?)

Another approach would be to create two separate recordsets, one which queries all the rows and a second with a WHERE clause to select only unprocessed rows, then swap them when the mode changes. Swapping is done by changing the form.Recordset attribute.  When I tried this, the datasheet view showed the row selection worked properly, but the first row was always made the current row.  I even used the FindFirst method to position the cursor, but it didn't work (..or it did work, but then was overridden by something else..)  When I tried this, the binding of the fields to the recordset seemed to be affected, and I'm not sure how to rebind them, or if it's even possible.  As a result, the events associated with the fields were affected and bizarre behaviors appeared.

Another possible approach would be to use only one recordset, but change the RecordSource queries .. one to select all rows, the other select with WHERE clause for unprocessed rows only.  I haven't tried this yet, but it seems promising.

Before I venture out on that path, I would like some input from the Experts.  Please let me know your take on the viability of these approaches, and suggest others which I haven't explored.  It's very possible that there is a simple approach that I'm not aware of.  

All suggestions and analysis of approaches is most appreciated.
At this point, I'm all ears.


Using Access 2007, with libraries for DAO:
 - Microsoft Office 12.0 Access database engine Object Library
 - Microsoft Jet and Replication Objects 2.6 Library

NOTE: For development, I'm running this against a local Access database.  For production, it must run against a remote SQL Server database.  I recall some citations along the way that stated there would be some limitations for some database connections.
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Jeffrey CoachmanMIS LiasonCommented:

Can you simplify this possibly?
MiltonLClarkStudentAuthor Commented:
I'd be glad to.. how do you suggest?
Jeffrey CoachmanMIS LiasonCommented:
Shorten it to one distinct question....

Or simply post a sample of the DB and state exactly what you want to do...

Sample database notes:
1. Back up your database(s).
2. Combine the front and back ends into one database file.
3. Remove any startup options, unless they are relevant to the issue.
4. Remove any records unless they are relevant to the issue.
5. Delete any objects that do not relate directly to the issue.
6. Remove any references to any "linked" files (files outside of the database, Images, OLE Files, ...etc)
7. Remove any references to any third party Active-x Controls (unless they are relevant to the issue)
8. Remove, obfuscate, encrypt, or otherwise disguise, any sensitive data.
9. Compile the code. (From the VBA code window, click: Debug-->Compile)
10. Run the compact/Repair utility.
11. Remove any Passwords and/or security.
12. If a form is involved in the issue, set the Modal and Popup properties to: No
    (Again, unless these properties are associated with the issue)
13. Post the explicit steps to replicate the issue.
14. Test the database before posting.

In other words, a database that we can easily open and immediately see and/or troubleshoot the issue.
And if applicable, also include a clear graphical representation of the *Exact* results you are expecting, based on the sample data.

Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

MiltonLClarkStudentAuthor Commented:
To boil it down to one distinct question, it would be:  what approach should I take to achieve the mode swapping I defined.

Secondly, as far as posting a database goes, that seems to be a moving target.  I code one approach and get most of the functionality working, but then it "breaks" a different part of the application.  I can post the database with the latest problem if that's what's needed.

Thanks everyone.
Jeffrey CoachmanMIS LiasonCommented:
Still confused.

Why are you using queries/recordsets in the first place?
It seems to me like you could just have a yes/no field in the table: IsProcessed
Then check this box when the record is processed.
Then just filter the Form accordingly:

Browse Unprocessed:

Browse All:


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
MiltonLClarkStudentAuthor Commented:
That's precisely the kind of input I'm looking for.  Seems like it's gotten overly complicated.
I think that's what I did at one point.  I'll give that a try and let you know how it works.

I'll get back to you.

Jeffrey CoachmanMIS LiasonCommented:
MiltonLClarkStudentAuthor Commented:
Right on target, JeffCoachman .. worked like a charm, and greatly simplifies the app structure.

Thanks again!!
MiltonLClarkStudentAuthor Commented:
This is exactly what I was hoping for.  This is why my subscription to Experts Exchange is so valuable.

Thanks again, boag2000/JeffCoachman.
Jeffrey CoachmanMIS LiasonCommented:
Jeffrey CoachmanMIS LiasonCommented:
Remember, I only posted the design change and the basic code.

You took the initiative and adapted this to work in your database on your own with no help from me...
So give your self some credit too!

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.