Solved

problem with a code vbyesnocancel on vba in access 2013

Posted on 2013-10-27
2
1,029 Views
Last Modified: 2013-10-27
hi

i have this code:

If Me.Closed = False And Not IsNull(Me.MecirahID) Then
    If MsgBox("do you want to close this form", vbYesNoCancel) = vbCancel Then
        Exit Sub
    ElseIf vbYes Then
        Me.Closed = True
    ElseIf vbNo Then
        Me.Closed = False
    End If
End If

Open in new window


but for some reason even when i click on the no in the msgbox it's  still  me.close=true
0
Comment
Question by:bill201
2 Comments
 
LVL 61

Accepted Solution

by:
mbizup earned 500 total points
ID: 39604524
Try this instead:
Dim intReturn

If Me.Closed = False And Not IsNull(Me.MecirahID) Then
    intReturn = MsgBox("do you want to close this form", vbYesNoCancel) 
    SELECT CASE intReturn
    Case vbCancel
        Exit Sub
    case vbYes 
        Me.Closed = True
    case vbNo 
        Me.Closed = False
    End Select
End If

Open in new window

0
 

Author Comment

by:bill201
ID: 39604541
it's  do not solved the problem, but i I found the solution what i change false to null

Anyway thanks alot for the efforts and therefore you deserve the points
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

I annotated my article on ransomware somewhat extensively, but I keep adding new references and wanted to put a link to the reference library.  Despite all the reference tools I have on hand, it was not easy to find a way to do this easily. I finall…
This article explains all about SQL Server Piecemeal Restore with examples in step by step manner.
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 …
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

757 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

21 Experts available now in Live!

Get 1:1 Help Now