Solved

problem with a code vbyesnocancel on vba in access 2013

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

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

Suggested Solutions

Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
As technology users and professionals, we’re always learning. Our universal interest in advancing our knowledge of the trade is unmatched by most industries. It’s a curiosity that makes sense, given the climate of change. Within that, there lies a…
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…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

808 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