473,396 Members | 2,023 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,396 software developers and data experts.

Undo in MS Access

Hello everybody
I have a question for which I have search net for last 3 hours but could not find answer.
I have an entry form over which I have placed an 'undo' button with following code
Expand|Select|Wrap|Line Numbers
  1. Private sub cmdUndo_OnClcik()
  2. If Form.Dirty Then
  3.  DoCmd.RunCommand acCmdUndo
  4. Else: Exit Sub
  5. End If
  6. End sub
  7.  
It works fine..
Now I come to the question that I find answer of;
When Its new record and I press Undo button after some entering data in some textbox controls, it deletes all record, because when I enter data again, Primary ID gets changed.
what I guess that its is because undo deletes all entries that has not been saved.
With this all in background, is there any way that undo deletes or erases data only from that control, in which it was entered just before pressing undo. And if its not possible, then is it possible that undo does not delete the record altogether and preserves primary ID?
Please help me find the answers
Thanks
Dec 10 '13 #1
1 1907
zmbd
5,501 Expert Mod 4TB
you've give scant information about how your form is designed and worse, what you have given is along the lines of "stream of conscense" which is hard for most people to follow.

From what I can tell,
The form is bound, either via query or directly to the table.
The primary-key is most likely an auto-number field.

IFF both are true then there is no way to preserve the autonumber once a record is started. It doesn't matter what method of undo is used, once new-record becomes dirty the next autonumber in sequence is assigned to the field and the index incremented. This is why all of the Experts here tell our members NOT to use the autonumber for anything other than a unique record id. If you need sequential numbers then there are methods such as DMAX()+1.

As for clearing the controls, most will have an undo for edited but not for new entries as a new entry was NULL() at inception unless a default value was assigned.
Dec 11 '13 #2

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

Similar topics

0
by: Daniel | last post by:
Is it possible to retain local file system read, write, delete access while impersonating for access to a remote drive in a different domain? I need to be able to move files from a local computer...
20
by: John | last post by:
Hi, I've recently upgraded from Access 97 to Access 2002 & the performance basically stinks. I have tried the following items listed below but it has only had a minor impact: 1) Upgraded Jet...
1
by: lbbs | last post by:
Will access allow you to undo more than one step. On mine it seams that you can only undo the last thing you did. In excel for example you can undo at least a dozen steps backwards. In...
2
by: Roger | last post by:
form A has a command button that opens form B in dialog mode DoCmd.openForm "frmProductPrice", acNormal, , , acFormEdit, acDialog, productId form B is a tabular form with 3 'required' fields ...
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...
2
by: Leslie | last post by:
On a form, I create a record and save, and am ready to enter another. I decide to Quit the form which executes an "Undo" in case there is data entered. This then tries to "delete" my just saved...
5
by: DeanL | last post by:
I know you can convert a database from Access 2003 to 97 easily but is there anything that I should avoid doing in Access 2003 that might make my database incompatible with Access 97? Many...
4
by: jamesnkk | last post by:
I have a list box which show all the Supplier PO Numbers, on the Right of the list box there is a command button called "Add", If user click the "Add' Button it will create a new PO ...
7
by: Richard Sherratt | last post by:
I'm trying to stop users deleting an existing value in a field. If they go to an existing record and hit delete, I want to give an error message and reverse the change. The BeforeUpdate event is...
1
by: Jeremy | last post by:
I'm working on an application that does some DOM manipulation. I want to add a mechanism for "Undo" so that the user can revert to the previous state after performing a mistaken action. Simple...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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:
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.