Solved

problem with a code vbyesnocancel on vba in access 2013

Posted on 2013-10-27
2
1,125 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
[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
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

Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

Question has a verified solution.

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

Azure Functions is a solution for easily running small pieces of code, or "functions," in the cloud. This article shows how to create one of these functions to write directly to Azure Table Storage.
This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
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 …

738 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