Ok, I'm going to give my 2 cents on this one.
It would be REALLY cool and really nice if we could wrap (with ease) a main form + sub form editing into one simple transaction.
After all, from a user's point of view, when editing say a invoice (and the classic sub form of invoice details)?
To them, it's just a "thing", and a simple save button to "save" and perhaps exit the "whole deal" they are looking at?
Yes sir, sign me up - from a user "UI" point of view, this is a great UI.
However, from the access "roots" of a bound form model?
It's just oh so messy. There are some examples - (using ADO recordsets), but really, at the end of the day, I suggest to "try" or at least "consider" some workarounds.
The problem is say vb.net or other windows platforms? They were from day one "set up" to work with a un-bound data source. As a result, they have wizards and all kinds of things to "help" with such an approach. In Access, if you dump/drop the data bound forms development model? Well, then you not only lack a bunch of wizards and "helper tools"?
But you also THEN lose many of the forms events, such as before up, after update - and a good many more. As noted, one can try to cobble together using dis-connected recordsets, but it really becomes a lot of work. And if you commit to doing this for one form + sub form, then you probably have to commit to doing this for all form + sub forms. So, it really goes against the RAD and simple approach that Access has - and that's a big reason for it's ease of use.
So, what have I done in the past to "get around" this problem?
A really effective work around is to introduce the concept of a "batch", or better stated a approved, or close batch process here.
Say for example we are doing that classic "quick books" like screen in which we receive a check/payment, and you THEN have to distribute that payment among several accounts. And of course as you split out the one check payment value into multiple accounts, then "eventually" the total check/payment value MUST = the distributed amounts to all the accounts you split up that payment into.
Now, with a un-bound setup, then the main form, payment amount, and then the distributed payments in the sub form?
Well, quite easy to have a single save button, and of course you can't exit until such time that the total amounts distributed to accounts matches the one single donation payment.
Well, the simple approach is to allow the user to edit, distribute, and EVEN if the totals don't match? Let them keep working!
What you THEN do is have a close/posting routine, and it simply does not let you "post" the run of payments until such time the sub form values match. (and by sub form, I actually mean the child table here).
So, what you do is have a new table, it is "higher" up, or simply one record that the "posting run" records are attached to.
And this approach works very well for workflow. Since the user can work, enter payments (and then distribute those payments). They can close down Access, keep working the next day.
THEN they can post the batch. That's when you test/check and ensure that the check/donation amount matches the distributed amount. And since you have a "batch" record, then that record has a simple posting flag, who posted, and what the posting run was for.
So, the form in question looks like this:
So, on left side, the user enterd $50. Now, on the right side, they have to keep entering (distrubting) amounts untill the total box goes "green".
However, I don't lock them out - they can stop entering anytime they want.
However, as above shows, that batch run is now already posted - and the form is now read only....
So, we have a top most record - the batch run......
So, from the user's point of view? They enter records, and when done, they post and close that batch run. This bodes well for such types of tasks, since with accounting packages, they have the same concept.
And I dare say, this simple approach not only allowed to ensure that payments (distributed) amounts match, but it eliminated the need for some kind of "single" save button for a form overall. And it even eliminated a bunch of complex code to "prevent" the user from entering a un-balanced set of distributued amounts for that payments. (the user is even free to exit that data entry form - come back later). However, until the batch is posted, then we don't include those records in reports etc. And we not really posting (despite the users thinking they are). In fact only ONE flag in the record shows that this batch been posted -- along with date and time and who did the data entry.
So, in place of trying to re-code and fight how Access works? Just introduce the above workflow - I found this approach works VERY well for such types of form + sub forms in which the data entry has to meet some special requirements (in this case, the distributed amounts have to match the payment amounts). So, don't lock the user out, don't prevent them from entering data that does not (yet) meet the requirements. Let them play, enter data - and then introduce that final posting and verification step.....
Now, to be fair, I can't say the above approach will work for all such cases (in which a single save wrapped in a transaction would be ideal), but in a lot of cases, the above re-design works well. And since it's building a "list" of work done, this bodes well from a user workflow point of view.
And the big bonus? Well, then we keep the familiar access bound forms model. So, it's a developer + coding friendly approach.
The lesson here?
Don't try and fight and re-purpose how Access works. Think of the overall final goal here, and then provide a UI and workflow that solves this problem - not trying to re-design how Access works. So, just let users enter data, and it's saved. And then have a separate "verification" run, which I called "posting" for this narrative.
I have found the above workflow works so well, that even if I had form + sub form transactions and a single save? I'm not convinced I would go down that road anyway.....
R
Albert