Hi all
I have a main single form (MainF) which displays various types of records through use of continuous subforms (SubF1 and SubF2) for an employee chosen on MainF.
To prevent accidental changes in records, I have put in an EditBtn which lets the user to change records. I have multiple controls on MainF, SubF1 and SubF2, if I change something and move onto the next control, the change gets saved in the underlying table. I'd like to be able to give the user option to press CancelBtn which will get rid of all the changed (and saved) records and restore original. Using Me.Dirty isn't exactly suitable here.
What I have tried is to use the following commands to make it work.
Behind EditBtn_Click() sub I have:
Similarly, behind CancelBtn_Click() sub I have:
What isn't working is INSERT INTO EmployeeT SELECT * FROM tmpEmployee. When I click CancelBtn, the db retains the new record rather than reverting back to previous, and deletes the record in tmpEmployeeT.
Appreciate all the help.
Note: I will be back to work on Tue next week, so I apologise in advance for not replying earlier than that
I have a main single form (MainF) which displays various types of records through use of continuous subforms (SubF1 and SubF2) for an employee chosen on MainF.
To prevent accidental changes in records, I have put in an EditBtn which lets the user to change records. I have multiple controls on MainF, SubF1 and SubF2, if I change something and move onto the next control, the change gets saved in the underlying table. I'd like to be able to give the user option to press CancelBtn which will get rid of all the changed (and saved) records and restore original. Using Me.Dirty isn't exactly suitable here.
What I have tried is to use the following commands to make it work.
Behind EditBtn_Click() sub I have:
Code:
Currentdb.Execute "INSERT INTO tmpEmployeeT SELECT * FROM EmployeeT WHERE EmployeeID = " & Me.EmployeeID
Similarly, behind CancelBtn_Click() sub I have:
Code:
Currentdb.Execute "INSERT INTO EmployeeT SELECT * FROM tmpEmployeeT WHERE EmployeeID = " & Me.EmployeeID
CurrentDb.Execute "DELETE * FROM tmpEmployeeT WHERE EmployeeID = " & Me.EmployeeID
What isn't working is INSERT INTO EmployeeT SELECT * FROM tmpEmployee. When I click CancelBtn, the db retains the new record rather than reverting back to previous, and deletes the record in tmpEmployeeT.
Appreciate all the help.
Note: I will be back to work on Tue next week, so I apologise in advance for not replying earlier than that