Hi,
As Mr. Rick said, you can have a variable or field in your
form and assign a value to it onclick of your close button
(Not X). Like:
variable = "True"
DoCmd.close acform, formname
If you see the variable falue later as true it means the
user is used ur command button to close the form. You can
add Onclose of this form another code to assing
value "False"
-----Original Message-----
Hi Rick Brandt,
But the close button (icon of x) is default button of form, not my button.
So that I can't/don't know how to trap the user-action like you mention.
Regards
Tran Hong Quang
Rick Brandt said:
news:16CAFE22-107C-4607-AC8E- (e-mail address removed)...
Hi,
How to detect that user click on the close button (button with icon of x)
on a running form?
Actually, I want to know how the form closed, by executing "DoCmd.close
acform, formname" or by clicking on close button.
The code (behind a button I assume) that uses DoCmd.Close could first set a
variable value. Then the Close event of the form can test that variable. If it
is set, then the user used your button, otherwise they used the [X].
.