cancel subform changes

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello again

I have a form with a subform. The subform displays multiple records linked to a single record on the main form

I was hoping to have a 'review' screen which will initially not allow changes. There would be a button on the main form saying 'edit details' - this would enable changes, and subsequently change the control caption to 'save changes' (there would be code for the control based on the control caption). It would also make an additional control visible saying 'Cancel changes'

It is this 'Cancel changes' button that I am having trouble with. There are loads of records and fields so I don't want to store every value in a variable. Is there a way that I can simply undo changes on click event

Thanks

Mikey
 
Hi Mikey

I don't know if you've solved this one yet, but I thought I'd put up a response anyway incase the thread is searched

This could quite simply be done by running a make-table query based on the data held when Edit is clicked. This will lock all the data into a new table (lets say [temptblOriginalResults]). You need to have a save button as well as a cancel button (you could change the caption onthe edit button) - on click of Save you could simply delete [temptblOriginalResults]

On click of cancel you could run an update query to amend the main tables data according to what is in [temptblOriginalResults]

You will need to put some code on the form's exit event in case they use the menu to close it whilst it is in the edit position. Maybe a yes/no msgbox which will prompt the selection of Save_click or Cancel_click

Good luck

Basi

----- Mikey wrote: ----

Nobody has answered the query yet, so I thought I'd offer a solution (that I'd still need help with though!)

Like I said, I want people to click a button ("Edit") that will allow changes on a form, but then have the option of undoing the changes made. Would it work to populate a recordset (on click of "Edit") from a query based on the table holding the form's data. If they then click "Cancel changes", an update query will send the data from the recordset back into the table. This last bit is what I would need help on

Firstly, I assume I would need to open the recordset as static in some way to make sure it doesn't change when the table is changed (through the form)

Secondly, how do I send data from a recordset into a table through a type of update query

If there is an easier solution, please advise

Many thanks

Mike

----- Mikey wrote: ----

Hello again

I have a form with a subform. The subform displays multiple records linked to a single record on the main form

I was hoping to have a 'review' screen which will initially not allow changes. There would be a button on the main form saying 'edit details' - this would enable changes, and subsequently change the control caption to 'save changes' (there would be code for the control based on the control caption). It would also make an additional control visible saying 'Cancel changes'

It is this 'Cancel changes' button that I am having trouble with. There are loads of records and fields so I don't want to store every value in a variable. Is there a way that I can simply undo changes on click event

Thanks

Mikey
 
Back
Top