M
Martureo Bob
Is there a technique to ***dynamically*** disable (grey out) and later
re-enable the Windows close ("X") button?
Here's why I ask...
My form can enter a critical processing phase where the user has gone into
"Add" mode (that's something within my application). The form's fields are
bound to the query, and some of the form's fields are defined in the table
as "required". If the user clicks the "X" before all the required fields
were entered, an error occurs because Access is then trying to close the
form but one or more of the table's properties are being violated.
BTW, my form has "Save" "Cancel" "Add" "Delete" and "Change" buttons.
I coded an OnUnload event with the hopes of canceling the close, but that
event occurs too late.
Aas a workaround, I added my own close button (control) on the form and
disabled the "X" in the control box property setting. I have an "OnClick"
event for that button that can intercept the situation and reject the user's
request to close the form --- but my users don't like the button --- they
want the "standard" way of closing the form (with the "X").
So I poked around the internet trying to try and find a WIN 32 API method of
greying out the "X" but I came up short.
I had thought of making all the form's fields "unbound" and then I suppose
the problem would go away. But then I would have to mess with the rest of
the code so that all those unbound fields would be moved to the database
when the user finally got around to clicking the form's "Save" button.
I would rather diddle with the "X" --- especially since this same situation
occurs of 4 of my application's forms.
Any clues?
THANKS!!!!
Bob (@Martureo.Org)
re-enable the Windows close ("X") button?
Here's why I ask...
My form can enter a critical processing phase where the user has gone into
"Add" mode (that's something within my application). The form's fields are
bound to the query, and some of the form's fields are defined in the table
as "required". If the user clicks the "X" before all the required fields
were entered, an error occurs because Access is then trying to close the
form but one or more of the table's properties are being violated.
BTW, my form has "Save" "Cancel" "Add" "Delete" and "Change" buttons.
I coded an OnUnload event with the hopes of canceling the close, but that
event occurs too late.
Aas a workaround, I added my own close button (control) on the form and
disabled the "X" in the control box property setting. I have an "OnClick"
event for that button that can intercept the situation and reject the user's
request to close the form --- but my users don't like the button --- they
want the "standard" way of closing the form (with the "X").
So I poked around the internet trying to try and find a WIN 32 API method of
greying out the "X" but I came up short.
I had thought of making all the form's fields "unbound" and then I suppose
the problem would go away. But then I would have to mess with the rest of
the code so that all those unbound fields would be moved to the database
when the user finally got around to clicking the form's "Save" button.
I would rather diddle with the "X" --- especially since this same situation
occurs of 4 of my application's forms.
Any clues?
THANKS!!!!
Bob (@Martureo.Org)