473,387 Members | 1,859 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Undo changes in a Sub Form

Hi Guys,

Been using this forum to get my answer for quite a while now, but finaly I am stumped.

I have a form with a subform. I control on the main form when the data is saved and when it is discarded.

However on my subform, if change is made, I cannot undo that change if the user press the cancel button on the main form.

I am trying to use the same cancel button for both forms, as the main form is a Singleform and the subform a datasheet.

Hope this makes sense!

Antmail
Jun 25 '07 #1
2 5275
hyperpau
184 Expert 100+
Hi Guys,

Been using this forum to get my answer for quite a while now, but finaly I am stumped.

I have a form with a subform. I control on the main form when the data is saved and when it is discarded.

However on my subform, if change is made, I cannot undo that change if the user press the cancel button on the main form.

I am trying to use the same cancel button for both forms, as the main form is a Singleform and the subform a datasheet.

Hope this makes sense!

Antmail

I was stucked with that problem before.
The problem is, you can't!!!!

You can only Undo data that is not yet saved.
as soon as your focus moves to the subform, the information entered
in the main form will be saved automatically, making it impossible to undo anymore.

It will be a long process to make it do what you want.

1. enforce referencial integrity of the main form to the sub form
2. Program the cancel button to delete record in the main form
DoCmd.RunCommand acCmdDeleteRecord
3. Program the main forms BeforeDeleteConfirm to display a message
reminding the user to remove all the items entered in the subfrm
before cancelling the form entry.
This message box would have the a YesNo button.
Yes if the user already removed the items in the subfrm and
No if not yet removed.
4. If user click yes, then the entry will be undone by deleting the record.
If user click no, the message would close and user goes back to the
form to remove the items.
5. To ensure accuracy, that the user really did remove the items before
clicking yes, Access checks the subfrm if it has entries. This is automatic
because you set the referential integrity. Therefore, you cannot delete
a form, if it has related records to its main form.
6. customize the AFterDeleteConfirm to a message box saying "Cancel |
Complete" Then automatically closes the form.

I suppose you know how to do these things. It worked for me.
the only thing is that if you are not using a customized autonumber field,
as you delete that record, the next entry would be the next autonumber field
generated by access.
Jun 26 '07 #2
Thanks Hyperpau,

It's not what I wanted to hear, but suspected. Hope Micro$oft gives us more control over that in Access 3020.

I actual started doing quite a bit of the things you suggested. But the process got so complex in manageing all scenarios, and seeing that this is an intrim solution until a proper web application has been developed, I decided not disallow edits on the subform.

I am creating a search form from which I then open the previous Subform, now as a Main form. Problem solved, but not clean, but it works.

Thanks for the help

Antmail
Jun 26 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: lkrubner | last post by:
I'm offering users the ability to type weblog posts into a form and post them. They type the text into a TEXTAREA which is on a form. The form, when submitted, hits a PHP script. Before it is...
1
by: Laertes | last post by:
In the Form_beforeupdate event : while the command Me.Undo works perfectly the Me.MyControl.Undo doesn't !!! I would like to make it work as I don't want to undo the changes in the whole form, but...
18
by: Darryl Kerkeslager | last post by:
I don't do much with subforms - in fact I've deliberately avoided them - but .... I have a tab control that will contain several subforms, each bound to a separate table, and each table/subform...
10
by: John Richardson | last post by:
General question about how WinForms handles undoing a change during a control's validation, if it does at all. After a change to a control's value, if the data is determined to be invalid, then in...
6
by: Raji16 | last post by:
Hi, I am a new member. i am designing a simple judicial database system. however after creating tables i am a bit confused on setting the relationships between tables :confused: here is the link...
3
by: GoogleEyeJoe | last post by:
Dear ladies and gents, I'm trying to determine whether the .NET Framework implements a means of transactional processing without the need for a database. Essentially, I'd like to enlist...
7
by: call_me_anything | last post by:
Hi, I am looking for a good algorithm (in C/C++) for implementing undo/ redo on a data structure. The data structure is basically a n-children tree somewhat of the form : class /* or...
5
by: jmarcrum | last post by:
Hey everybody! I've created 2 buttons that I've placed on all my forms: a Save button & a Cancel button. The cancel button I have a question about. I used the wizard to create the button...
2
by: yedidel | last post by:
Hello, I have a form that edits an Order. Each order has several OrderItems which are edited by a continous-form subform inside the main form. Each OrderItem also has several OrderItemsAdditions...
2
by: maxx429 | last post by:
Hi all, I am a VBA newb. I know probably just enough to be dangerous. :) Anyway, I have a Form that I am using <a href="http://allenbrowne.com/AppAuditCode.html">Allen Brown's Audit Trail</a> ...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.