Quote:Thanks for suggestion, Mark
I will have to read this a few times to fully understand it.
But my initial reaction is that this sounds impractical if we do all data entry and then go to the Parent. If a person is doing a lot of data entry, and creating "bad" records then they will have to go back and reedit every one of them. If the error was caught on the first record, then they would be alerted, and probably not repeat the error.
Probably not the case, if you use the main form with unbound elements for the data entry. You can use the table for data entry (though I wouldn't) and validate as you go. But that probably won't please the data entry pros.
Quote:I also like to use data already entered to make decsisions in later processes and calculations. If a records turns out to re invaldi then I may have triggered other wrong conditions. Writing code to undo/redo can get complex.
Use variables and "state programming" and you should not ever have that condition. Don't trigger until you know you have a valid data state.
Quote:There must be a simple way to validate "mandatory" fields are correct before moving to the next record.
You can. You can, if you wish, validate every letter as it is entered, You can run programming on enter and exit for each LE and line in the table. If you find a problem you can warn the user. And, because the subrecords are not "saved" until the parent is saved, you can prevent "bad" data from being entered into your application.
Control the data, not the user. Inform and guide the user. But, assume in all of your programming that the data will be wrong. Assume that it will be entered incompletely. Assume that it will be entered in an unexpected order.
Quote:Unless we are passing control to the parent on exit from the subrecord, doing some kind of check, and then returning to the next subform record either for next data entry or with an error message to the operator.
I would still recommend that you consider using the parent and normal (as opposed to "tabled") LEs for data entry. If this is a data entry intensive application, I would recommend using a form based subform - they are much easier on data entry. Possibly build a duplicate main form with a table view subform for management summary.
You can check your data as the user enters it in the table view subform, and warn the user appropriately. It will be substantially more difficult to trap the user where they are until they get it right. But since the subrecords are not saved until the parent is saved, and you can prevent the parent from being saved, you shouldn't need to trap the user to get the data right.
Quote:I don't need all the detailed code that Ray ususally provides, I can fill that in from a structural flow. Can you provide a flow concept here with mention of the special commands where they might be needed?
What you should do depends heavily on the requirements put on you, the experience level of the data entry people (and their temperament), the length of time any one user will use the application, and the amount of time you wish to spend on the project.
If, for example, you are building an app that will be used by a user once and they are unlikely to build up experience using the app (like a kiosk), you will probably want to use a "wizard-like" approach, were the user is asked to answer only a single question at a time, in order, with static on screen instructions. But, if you are building something that will be used multiply by the same user, they will build up experience, and a linear interface will only hinder them in the long run, and the instructions will be eating space they could profitably use.
If you have fields that must be filled in by the user (as opposed to programming), and they must be correct, check them at every opportunity and set flags indicating their status. Use the "form" routines (like @formfieldvalue) rigorously and set static globals as needed. Remember that "nothing counts", nor needs to be correct, until the user advances the main record, at which point the brakes should be (and can be) rightfully applied. If fields can have only limited values, offer those values as obvious choices. Use variables and unbound LEs as much as possible to prevent access to critical and bound LEs, and to create a data filter between the user and the critical LE.
If there are sets and combinations that are critical in relation to one another, include in that set a "Completed" LE to indicate that that set of data is incomplete and must be completed, or possibly ignored (with sufficient warning). Incomplete and revalidate anytime the user approaches that set of LEs.
Quote:Anyone else with ideas on how they have taken care of this in subforms?