I know this is still in the rough and this needs a lot of work, but look at the concept.
I am trying to find a way to allow the user to edit an existing record set (parent and/or child records) and decide if they want to save or cancel the changes after they are committed, but before moving to another parent record.
The attached database is a start. It has a parent table and 2 child tables, 'invoicedetails' child table holds the permanent data and 'invoicedetails2' holds the temporary data that is viewed/edited on the form (for the child records, this does not address the parent record yet). The 'invoicedetails2' table is emptied and reloaded from the 'invoicedetails' table with each parent record that is viewed in the form; the only records in this table are the child records for the current parent record (look at the forms 'onfetch' event). The changed records are then written back to the permanent table when the invoice is saved (look at the save button). This all seems to be working as far as I have tested it.
Now the next thing I am trying to do is determine if the user made any changes to the currently viewed records and confirm if they want to save or cancel the changes. I was going to do this by setting a logical field in the parent record to false from the canchange event of the form and the onrowchange event of the browse and checking that field before moving on. But the problem is those events fire from the code in the onfetch event that runs with each advance of the parent record and the logical field gets changed. Is there a way to turn the events off temporarily or how should this be done.
Another thing I need to address is to pack the 'invoicedetails1' table periodically as it gets a lot of deleted records over time. I tried doing this from the forms onexit event, but it gives me a 'table in use' error. Any ideas?
Maybe there is a better way to accomplish being able to cancel changes to records in a set. I am open to any good ideas.
Thanks, Dan
I am trying to find a way to allow the user to edit an existing record set (parent and/or child records) and decide if they want to save or cancel the changes after they are committed, but before moving to another parent record.
The attached database is a start. It has a parent table and 2 child tables, 'invoicedetails' child table holds the permanent data and 'invoicedetails2' holds the temporary data that is viewed/edited on the form (for the child records, this does not address the parent record yet). The 'invoicedetails2' table is emptied and reloaded from the 'invoicedetails' table with each parent record that is viewed in the form; the only records in this table are the child records for the current parent record (look at the forms 'onfetch' event). The changed records are then written back to the permanent table when the invoice is saved (look at the save button). This all seems to be working as far as I have tested it.
Now the next thing I am trying to do is determine if the user made any changes to the currently viewed records and confirm if they want to save or cancel the changes. I was going to do this by setting a logical field in the parent record to false from the canchange event of the form and the onrowchange event of the browse and checking that field before moving on. But the problem is those events fire from the code in the onfetch event that runs with each advance of the parent record and the logical field gets changed. Is there a way to turn the events off temporarily or how should this be done.
Another thing I need to address is to pack the 'invoicedetails1' table periodically as it gets a lot of deleted records over time. I tried doing this from the forms onexit event, but it gives me a 'table in use' error. Any ideas?
Maybe there is a better way to accomplish being able to cancel changes to records in a set. I am open to any good ideas.
Thanks, Dan
Comment