Solved

docmd.closeform

Posted on 1998-02-17
6
426 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
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

It took me quite some time to sort out all the different properties of combo and list boxes available from Visual Basic at run-time. Not that the documentation is lacking: the help pages are quite thorough and well written. The problem was rather wh…
Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

708 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

19 Experts available now in Live!

Get 1:1 Help Now