Solved

docmd.closeform

Posted on 1998-02-17
6
441 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
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
Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

 
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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

QuickBooks® has a great invoice interface that we were happy with for a while but that changed in 2001 through no fault of Intuit®. Our industry's unit names are dictated by RUS: the Rural Utilities Services division of USDA. Contracts contain un…
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …

813 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now