text box with confirmation and cancellation when changing value behind an update (1 Viewer)

RunePMI

New member
Local time
Today, 14:05
Joined
Mar 17, 2023
Messages
5
hello

if i change a value there should be a text box. and if you press yes, for example, the value changes and if you press no, the old value remains. how to do this
 

bob fitz

AWF VIP
Local time
Today, 14:05
Joined
May 23, 2011
Messages
4,727
hello

if i change a value there should be a text box. and if you press yes, for example, the value changes and if you press no, the old value remains. how to do this
I think a clearer description o what you have, what you need, and a little more detail would be useful.
Perhaps even a copy of your db.
..."if i change a value there should be a text box" a value where?
..."and if you press yes, for example, the value changes" what/where is the "Yes" and what "value" changes?
 

RunePMI

New member
Local time
Today, 14:05
Joined
Mar 17, 2023
Messages
5
my apologies

as you can see in the image below I have few different values. Location, amount and min amount should not be accidentally changed. therefore if you want to change this value there should be a text box with do you want to change this value yes or no. if you choose yes, the value of, for example, location must change. if you choose no, the old value will remain. hopefully it's a bit clearer now
1679048655935.png
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 21:05
Joined
May 7, 2009
Messages
19,245
use BeforeUpdate event of the Form:

Private Form_BeforeUpdate(Cancel As Integer)
Cancel = (Msgbox("Do you want to save changes?", vbYesNo+vbQuestion) = vbNo)
If Cancel Then Me.Undo
End Sub
 

bob fitz

AWF VIP
Local time
Today, 14:05
Joined
May 23, 2011
Messages
4,727
You could use code, similar to that which arnelgp has given you, in the BeforeUpdate event of "amount" and "min amount" which would enable to give a more detailed warning to the user about what values are about to be altered.
 

RunePMI

New member
Local time
Today, 14:05
Joined
Mar 17, 2023
Messages
5
Ik heb het alleen zo opgelost als ik op ja druk, het wil de waarde niet opslaan. hoe doe je dit?

1679051600710.png
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 21:05
Joined
May 7, 2009
Messages
19,245
just Undo the control:

' Undo the change
Cancel = True
Me!location.Undo
 

Users who are viewing this thread

Top Bottom