Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Modify form data but not update it 1

Status
Not open for further replies.

meckeard

Programmer
Aug 17, 2001
619
0
0
US
Hi,

I have a subform that is linked to a query and displays the results.

I wrote some code that will allow the user to copy all the records. Before they copy, I need to allow them to modify any data on the subform.

Everything works well until the form gets closed. It updates the original record but I can't let that happen.

Is there a way to allow a user to edit a record but not allow the form to update it??? Can the update be suppressed?

Thanks,
Mark
 
1) You can use me.undo. That will undo any changes. I'm not sure exactly where you would put that. The before update event might be a good choice, but you'll be undoing all updates and I'm not sure if you want to do that.

2)Another option is to use unbound controls on the subform and set the unbound controls to the original data. That way the underlying data won't be updated when you close the form. You'll have to find the proper place to set the unbound controls on your subform to the underlying data (maybe in the on current event?) (maybe when they select/perform an action on the main form?)
 
Assuming you've split the database into frontend application and backend database, you could have a local table in the front end. When you open the form, you could load the local table with the required data.

The form's recordsource is the local table, not the backend "real" data.

That way when the user makes changes, they're only changing their local copy of the data.

When the form closes it could empty the local table, making it ready for the next time the form is opened.

It would be advisable to set the "Options / General / Compact on Cose" option to true (checked)

Not the most elegant solution, but it works (!!!)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top