Me.Dirty "Do you wish to save?" how to on unbound form?

mamradzelvy

Member
Local time
Today, 08:33
Joined
Apr 14, 2020
Messages
145
Hi,
how would i do a check before exit dialog window on a unbound form?
do i just check each of the boxes for any values and based on that ask whether i should INSERT query, or is there a better way?
 
I'm not sure what you are asking for? Did you want to perform a validity check on your entries before the form closes?

If so, you need to perform these actions on the BeforeUpdate event....
 
I'm not sure what you are asking for? Did you want to perform a validity check on your entries before the form closes?

If so, you need to perform these actions on the BeforeUpdate event....
Ah sorry, no i meant rather a discard or save data within said form's txtboxes when you accidentally attempt to close the form or access.
 
That is correct (at least that is my understanding!)

Have a look at this thread, it may give you some ideas and/or answer your question(s).
 
Ah sorry, no i meant rather a discard or save data within said form's txtboxes when you accidentally attempt to close the form or access.
Best way to do this is to make the form a Modal and set the Control Box and Close properties to "No". Place a Command button on the form which will ask the user if they really want to close the form and respond accordingly...
 
On unbound forms, I would normally have a boolean control variable that flags if any data has changed.
Set it on any controls where the data is changed, and use that to perform the "save it or lose it" dialogue.
 
Best way to do this is to make the form a Modal and set the Control Box and Close properties to "No". Place a Command button on the form which will ask the user if they really want to close the form and respond accordingly...
But does that take effect on alt+f4, or closing from win control pane?
 
I often use unbound forms. Correct me if I am wrong (test it), but I believe that the form automatically saves all control changes on exit. I believe you need to go the way of the "undo" command to 'not' save the data, per each control. Like Minty said, you can use flags to track which controls have changed, or you can try merely "undo" each control and see if it generates errors when they haven't changed (and put the error number and 'resume next' in an error handler routine).
 
I often use unbound forms. Correct me if I am wrong (test it), but I believe that the form automatically saves all control changes on exit. I believe you need to go the way of the "undo" command to 'not' save the data, per each control. Like Minty said, you can use flags to track which controls have changed, or you can try merely "undo" each control and see if it generates errors when they haven't changed (and put the error number and 'resume next' in an error handler routine).
Where does it save them to? :unsure:
 
Where does it save them to? :unsure:
Yes, I was talking about TextBox Controls. It saves to the place the control is bound to.
I can assume the TextBox Controls are bound, otherwise why/how would he need to have an exit dialog "do you wish to save?" confirmation?
 
Unbound form does not mean unbound textboxes. You can bind individual textboxes to different sources. Otherwise, what data could you you talking about to save on that form?
 

Users who are viewing this thread

Back
Top Bottom