?
Solved

docmd.closeform

Posted on 1998-02-17
6
Medium Priority
?
464 Views
Last Modified: 2008-02-01
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 !!
0
Comment
Question by:kiddiec
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 5

Expert Comment

by:cekman
ID: 1968709
Prior to the close insert:

On error resume next
0
 
LVL 2

Author Comment

by:kiddiec
ID: 1968710
I have already tried on error resume next
0
 
LVL 3

Expert Comment

by:guillems
ID: 1968711
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.
0
Veeam Disaster Recovery in Microsoft Azure

Veeam PN for Microsoft Azure is a FREE solution designed to simplify and automate the setup of a DR site in Microsoft Azure using lightweight software-defined networking. It reduces the complexity of VPN deployments and is designed for businesses of ALL sizes.

 
LVL 1

Accepted Solution

by:
JeroenW earned 100 total points
ID: 1968712
Try inserting the following code:

sub MyCloseButton_Click()

dim answer as integer

'The vbYesNo doesn't apply to Access 2.0 search help
'on msgbox...
answer = msgbox = "Do you want to exit?",vbYesNo (*)
if answer = vbYes then
    Docmd close
endif

exit sub

Hope it helps,

Jeroen W



0
 
LVL 1

Expert Comment

by:JeroenW
ID: 1968713
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



0
 
LVL 3

Expert Comment

by:guillems
ID: 1968714
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.

0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The Windows Phone Theme Colours is a tight, powerful, and well balanced palette. This tiny Access application makes it a snap to select and pick a value. And it doubles as an intro to implementing WithEvents, one of Access' hidden gems.
Traditionally, the method to display pictures in Access forms and reports is to first download them from URLs to a folder, record the path in a table and then let the form or report pull the pictures from that folder. But why not let Windows retr…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Suggested Courses

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question