[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1181
  • Last Modified:

problem with a code vbyesnocancel on vba in access 2013

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
bill201
Asked:
bill201
1 Solution
 
mbizupCommented:
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
 
bill201Author Commented:
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

Veeam and MySQL: How to Perform Backup & Recovery

MySQL and the MariaDB variant are among the most used databases in Linux environments, and many critical applications support their data on them. Watch this recorded webinar to find out how Veeam Backup & Replication allows you to get consistent backups of MySQL databases.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now