Undo typing (1 Viewer)

Dick7Access

Dick S
Local time
Today, 18:44
Joined
Jun 9, 2009
Messages
4,203
I know I can use Ctrl Z.
Is it possible to put a Undo typing Command button, on a Access form
 

Isaac

Lifelong Learner
Local time
Today, 15:44
Joined
Mar 14, 2017
Messages
8,809
There's Me.Undo, but I think that undirties the entire form - all fields. (if I remember right?)
 

Dick7Access

Dick S
Local time
Today, 18:44
Joined
Jun 9, 2009
Messages
4,203
There's Me.Undo, but I think that undirties the entire form - all fields. (if I remember right?)
Yes, I believe it does.
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 17:44
Joined
Feb 28, 2001
Messages
27,253
Some controls - but not all of them, apparently - allow ctrlname.Undo - but the trick would be how to specify it, because in order to have another control, call it AUndo, to undo typing in a control named A, you would have to click AUndo - which means focus would now be in AUndo, not in A. And that means that AUndo.Click event would have to name the control A specifically. So it may be impossible to have ONE control that undoes the last control regardless of what it was. You MIGHT be able to do one button per control - like AUndo, BUndo, CUndo, etc. to undo typing in A, B, C, etc. - which would become burdensome very fast if you had a LOT of controls.

With CTRL/Z, at least you don't change focus. And with Me.Undo, focus doesn't matter as long as it is somewhere on the form.
 

Isaac

Lifelong Learner
Local time
Today, 15:44
Joined
Mar 14, 2017
Messages
8,809
Some controls - but not all of them, apparently - allow ctrlname.Undo - but the trick would be how to specify it, because in order to have another control, call it AUndo, to undo typing in a control named A, you would have to click AUndo - which means focus would now be in AUndo, not in A. And that means that AUndo.Click event would have to name the control A specifically. So it may be impossible to have ONE control that undoes the last control regardless of what it was. You MIGHT be able to do one button per control - like AUndo, BUndo, CUndo, etc. to undo typing in A, B, C, etc. - which would become burdensome very fast if you had a LOT of controls.

With CTRL/Z, at least you don't change focus. And with Me.Undo, focus doesn't matter as long as it is somewhere on the form.
Possibly what you are saying, + a little coding with a global variable for the 'current' (or 'last') control name? Plus some SetFocus and ControlName.Undo actions?
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 17:44
Joined
Feb 28, 2001
Messages
27,253
@Isaac - true, but at some point it is easier to remember CTRL/Z
 

sinavere

New member
Local time
Tomorrow, 00:44
Joined
Jan 28, 2021
Messages
8
@The_Doc_Man - Never underestimate the boundaries of stupidity.
In my company there are many employees with zero computer skills. We hired them for their teachingskills, but can't avoid them having to touch the system once in a while.
Sometimes my eyes are almost popping out, haha. "How on earth did you manage to do this...?!"

On topic: Would it be possible to execute the keycode for control Z by clicking an 'undo last typing' button. The control doest need focus for that I think?
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 17:44
Joined
Feb 28, 2001
Messages
27,253
Look into using SendKeys. I have my doubts, but not certainties regarding this. The little bit that I could find doesn't suggest the need for focus. You might also be able to send Alt+Backspace for the same effect. Send the Esc key is ambiguous if there is a bound record on a form because Esc will do a "Typing Undo" and a "Record Changes Undo" if you hit it twice.

Sometimes my eyes are almost popping out, haha. "How on earth did you manage to do this...?!"

The way to stop this takes effort, but you need to fix things so that nobody has the CHANCE to screw up. This is actually the second part of Murphy's Law. Ed Murphy (of Murphy's Law fame) was a real person at White Sands, NM during the rocket-sled tests of the 1950s. His famous law is commonly only half-remembered. The first half is "That which CAN go wrong WILL go wrong." The part that everyone forgets is "Therefore, make it so it can't go wrong." The DIRECT offshoot of this law is molded plugs that can ONLY be inserted into their sockets in one way because of some asymmetry in the shape. (The event that led to his infamous formulation was when some poor guy pulled 9 Gs during a rocket sled run but because the plug was in upside down, they recorded nothing.)

It is possible to control what your people do. You need to look up the topic "Securing a Database" in this forum. There should be a bunch of reading material on how to do that. It starts with a very simple principle. Under no circumstances should anyone EVER, at ANY TIME, see the navigation panel, ribbon, or action menus.
 

sinavere

New member
Local time
Tomorrow, 00:44
Joined
Jan 28, 2021
Messages
8
The first half is "That which CAN go wrong WILL go wrong." The part that everyone forgets is "Therefore, make it so it can't go wrong."
Thank you for reminding me.
That IS why I love programming so much. With enough logic, everything can be fixed.
I will take a look at that topic.
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 18:44
Joined
Feb 19, 2002
Messages
43,385
I'm curious. Access has a command to do what you want. Why do you want to build your own?
 

Dick7Access

Dick S
Local time
Today, 18:44
Joined
Jun 9, 2009
Messages
4,203
Hi Pat. I knew you would be the one to ask that. <G> The adaption of my Calendar DB has a form made by my tech in Venezuela with some other language than access, and Ctrl Z doesn't work. On top of that I have neuropathy in both hands and sometimes trying to copy with Ctrl C my finger doesn’t hold down Ctrl and I lose my data.
 

Gasman

Enthusiastic Amateur
Local time
Today, 23:44
Joined
Sep 21, 2011
Messages
14,376
Hi Pat. I knew you would be the one to ask that. <G> The adaption of my Calendar DB has a form made by my tech in Venezuela with some other language than access, and Ctrl Z doesn't work. On top of that I have neuropathy in both hands and sometimes trying to copy with Ctrl C my finger doesn’t hold down Ctrl and I lose my data.
@Dick7Access,
So in that case it is your Venuzuelian compatriot you should be asking that question to and not the Access people?
 

Dick7Access

Dick S
Local time
Today, 18:44
Joined
Jun 9, 2009
Messages
4,203
Technically your right, and I will get to him later, however in the meantime the thought accrued to me if I was trying to idiot proof a form for non computer person who had no idea of any key functions, would I be able to put a 3 inch by 4 inch button in red that says “UNDO UNDO”. The answer is “Not Easily”
 

Gasman

Enthusiastic Amateur
Local time
Today, 23:44
Joined
Sep 21, 2011
Messages
14,376
Well as I asked, could you use the previous control object and then just clear the control, but that would be for access.?
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 18:44
Joined
Feb 19, 2002
Messages
43,385
The exc key backs out changes for the active control. hitting the esc key twice clears thw whole record.
 

twgonder

Member
Local time
Today, 17:44
Joined
Jul 27, 2022
Messages
178
I've done a bit of testing and trying. The problem is, undo and redo either by code or with ctrl-z/y don't do the same things as the controls on the Quick Access Toolbar, which I plan to disable in production. For example, enter someting in a textbox, then undo it. Ctrl-y doesn't work but the redo on the toolbar does.

We need a way to put the controls that are on the toolbar into a form that is modal or otherwise can't get to the Toolbar.
 

Users who are viewing this thread

Top Bottom