Expand my Community achievements bar.

SOLVED

How to suppress the Save Dialog before closing the form?

Avatar

Level 3

Dear all,

I created a form which will open a data connection on a button click.

I catch the error on failure and code to close my form by app.execMenuItem("Close");

but a Save Dialog will appear before I can close it.

(may be because I have done something on opening the form),

is it able to suppress it? Or simply cannot?

Best Rgds.

1 Accepted Solution

Avatar

Correct answer by
Level 10

Hmmm,

what if you add?

event.target.dirty = false;

app.execMenuItem("Close");

View solution in original post

4 Replies

Avatar

Level 10

Hi,

you can use

event.target.closeDoc(true);

This will close the doc without prompting the save as dialog.

Avatar

Level 3

but it seems that after event.target.closeDoc(true);

the codes that follow will continue to run,

but this doesn't happen if I use app.execMenuItem("Close");

I already include the closeDoc inside the try catch.

Avatar

Correct answer by
Level 10

Hmmm,

what if you add?

event.target.dirty = false;

app.execMenuItem("Close");

Avatar

Level 3

Thanks Radzmar, it works!

Rgds.