Select to view content in your preferred language

Stop form 'Cancel' execution

934
4
Jump to solution
04-18-2013 05:29 AM
AaronAmbrose
Deactivated User
Hi, I have created a form that has a page that references child forms. Children can be added and reopened for editing from this page; very similar to 'related tables.' And they are associated thru a set of parent / child UIDs.
One major problem I am having with it all though, is that when a user clicks cancel (whether by choice or by accident) on one of the child forms, the dang data collectors very often treat the tap as a double tap, and so the second tap hits the cancel of the Parent form - completely orphaning all the children because the UID association is now NOT written.
This is a major issue - as data can be entered for up to an hour or two on each item! Plus, now we have a bunch of orphaned elements that cause other problems downstream.
So, I figured it would be an easy fix; just put a validation script ("ThisEvent.Result = False...") in the parent form 'Cancel' button that scouts for children and if found - dis-allows cancel execution. But this doesn't seem to work as it does on validation events. Nothing happens...

So, is there a way to either,
a) stop execution of the event onclick of Cancel?
b) hide or disable the Cancel button?
c) write certain values to the perminanct record upon entry or specific event?
d) or even if I could move the Cancel button location on the parent form so inadvertent double tapping/execution doesn't occur

Choices 'a & b' would be preferred, but I am expecting 'c' to be the only solution from the vets here. But even if it is, I think I will need an example code for it.

Thanks,

Aaron
Tags (3)
0 Kudos
1 Solution

Accepted Solutions
AaronAmbrose
Deactivated User
I know this thread is a little old, but just in case anyone else was wondering...

I don't know of a way to hide the Cancel button, but you can override it.

dim result
result = Msgbox("You have clicked the Cancel button.  This will cause the form to close." & vbcrlf & "Are you sure you want to quit?", 1 ,"Cancel Verification")
if result = 2 then
     thisevent.result=false
end if


Add this script to the OnQueryCancel event in the Page Properties of the form.

Cheers!


Wow! You Rock ssdema!
I finally got to test it out; all I really needed was 'thisevent.result=false' (plus any appropriate alert message or 'if' statement).
What I find odd though, is that I had tried this very method, only using it on the 'Form' OnCancel event, and anything I scripted in worked, except this statement ('thisevent.result=false'). I never even thought to look for this type of event on 'page' events.

Well thanks a billion - this solves a big problem for me!!!
And I know that many other people want this little nugget too, as I discovered while googling for an answer (with no avail).

Cheers ssdema!

View solution in original post

0 Kudos
4 Replies
AaronAmbrose
Deactivated User
So, no one has an answer for this?
Could really use help on this!

Even if the only solution is number 3 where you have to write directly to record (for UID values) upon data entry.
I'm not really sure how to go about doing this.
One issue I forsee, is when you are adding a new feature as opposed to editing an existing one (as there will be no record found to write to). But perhaps a sub could be set up so that - upon placement of a new parent feature, the form would enter any auto calculated values, then exit and re-enter - all without bringing attention to the user (except perhaps a second of lag).

Any input on this anyone?
0 Kudos
SandraDema
Emerging Contributor
I know this thread is a little old, but just in case anyone else was wondering...

I don't know of a way to hide the Cancel button, but you can override it.

dim result
result = Msgbox("You have clicked the Cancel button.  This will cause the form to close." & vbcrlf & "Are you sure you want to quit?", 1 ,"Cancel Verification")
if result = 2 then
     thisevent.result=false
end if


Add this script to the OnQueryCancel event in the Page Properties of the form.

Cheers!
0 Kudos
AaronAmbrose
Deactivated User
I will try this out as soon as I get some time; if it works; God bless you Ssdema!
0 Kudos
AaronAmbrose
Deactivated User
I know this thread is a little old, but just in case anyone else was wondering...

I don't know of a way to hide the Cancel button, but you can override it.

dim result
result = Msgbox("You have clicked the Cancel button.  This will cause the form to close." & vbcrlf & "Are you sure you want to quit?", 1 ,"Cancel Verification")
if result = 2 then
     thisevent.result=false
end if


Add this script to the OnQueryCancel event in the Page Properties of the form.

Cheers!


Wow! You Rock ssdema!
I finally got to test it out; all I really needed was 'thisevent.result=false' (plus any appropriate alert message or 'if' statement).
What I find odd though, is that I had tried this very method, only using it on the 'Form' OnCancel event, and anything I scripted in worked, except this statement ('thisevent.result=false'). I never even thought to look for this type of event on 'page' events.

Well thanks a billion - this solves a big problem for me!!!
And I know that many other people want this little nugget too, as I discovered while googling for an answer (with no avail).

Cheers ssdema!
0 Kudos