R
RM Ashraf
Hi
I have a form with 3 subforms. Form has a Cancel button to undo all the
changes. The problem comes when my main and subform has some new data
entered. Access savea the data before loosing focus, so when I move focus
from main to a child form, it saves my main form and on pressing button it
again moves focus to the main form so save subform :-( I can delete the
currently added record which works for addition of a new record but what
about editing the existing record. It again saves but deleting is not an
option here. First I was trying to use BeginTrans, CommitTrans, Rollback
Methods of a workspace object. I had a global variable of type workspace
which is set in OnLoad event of form to DBEngine.Workspaces(0). After this
when user press Add or Edit buttons I use MyVariable.BeginTrans to start the
transaction. But MyVariable.RollBack in my cancel button, didn't work. I
don't know if I was doing right or even if it was possible. Thie problem I
can think of is because of the scope if MyVariable.
Then I tried to use RecordsetClone to make a copy of recordset to restore it
later, but it appears that Clone just stores the refereneces and not the
actual values so when the actual values are changed, clone values are changed
too.
Next Now I will try to make an array of fields to store previous values,
which I can think of my last option. Any other ideas of doing this??
Any help would be appreciated.
Rashid
I have a form with 3 subforms. Form has a Cancel button to undo all the
changes. The problem comes when my main and subform has some new data
entered. Access savea the data before loosing focus, so when I move focus
from main to a child form, it saves my main form and on pressing button it
again moves focus to the main form so save subform :-( I can delete the
currently added record which works for addition of a new record but what
about editing the existing record. It again saves but deleting is not an
option here. First I was trying to use BeginTrans, CommitTrans, Rollback
Methods of a workspace object. I had a global variable of type workspace
which is set in OnLoad event of form to DBEngine.Workspaces(0). After this
when user press Add or Edit buttons I use MyVariable.BeginTrans to start the
transaction. But MyVariable.RollBack in my cancel button, didn't work. I
don't know if I was doing right or even if it was possible. Thie problem I
can think of is because of the scope if MyVariable.
Then I tried to use RecordsetClone to make a copy of recordset to restore it
later, but it appears that Clone just stores the refereneces and not the
actual values so when the actual values are changed, clone values are changed
too.
Next Now I will try to make an array of fields to store previous values,
which I can think of my last option. Any other ideas of doing this??
Any help would be appreciated.
Rashid