Link to home
Start Free TrialLog in
Avatar of kiddiec
kiddiec

asked on

docmd.closeform

I have a button on my form (created by the wizard) which closes the form.  In the close event of the form the user has the option to cancel the close.  How do I stop access displaying a message advising the user that the docmd action had been cancelled ?  I have tried docmd.setwarnings false but this does not work !!
Avatar of cekman
cekman

Prior to the close insert:

On error resume next
Avatar of kiddiec

ASKER

I have already tried on error resume next
The code that I use in my form is:

Private Sub Comando0_Click()
  On Error Resume Next
        DoCmd.Close
End Sub

Private Sub Form_Unload(Cancel As Integer)
  If (vbYes = MsgBox("exit?", vbYesNo)) Then
    Cancel = False
  Else
    Cancel = True
  End If
End Sub

' ---  Comando is the close's button

It's woks, well. But I thing the solution is for cekman.
ASKER CERTIFIED SOLUTION
Avatar of JeroenW
JeroenW

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Oh yeah, you'll have to remove the message from the close event.
Could you tell me what's in the close event? Maybe you can remove the whole thing.

Hope it helps,

Jeroen W



Sorry, JeroenW. Read the history before answer a question! and read the question too!!!

I think your response is not good, because he asks something different. And I think the answer's CEKMAN IS GOOD, The solution works well.