Link to home
Start Free TrialLog in
Avatar of military donut
military donutFlag for United States of America

asked on

vbYes and vbNo, either way not working

hello,

I am having another rough day.

I have this code and can't seem to get it to work...whether you push yes or no it returns to the form and does nothing...

If Me.Dirty Then
    MsgBox "You must either finish the record or cancel the record, Do you want to cancel this record?", vbYesNo
    If response = vbYes Then
        Me.Undo
        DoCmd.OpenForm "frmLicense"
        Else
            If response = vbNo Then
                Exit Sub
            End If
    End If
Else
DoCmd.OpenForm "frmLicense"
End If

what am I missing?
Avatar of Jim Dettman (EE MVE)
Jim Dettman (EE MVE)
Flag of United States of America image

You have to do:

 If MsgBox( "You must either finish the record or cancel the record, Do you want to cancel this record?", vbYesNo) = vbYes Then

or

Dim intRet as integer

intRet = MsgBox ("You must either finish the record or cancel the record, Do you want to cancel this record?", vbYesNo)

If intRet = vbYes Then

Jim.
ASKER CERTIFIED SOLUTION
Avatar of PatHartman
PatHartman
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
MsgBox "You must either finish the record or cancel the record, Do you want to cancel this record?", vbYesNo
>>>
response = MsgBox "You must either finish the record or cancel the record, Do you want to cancel this record?", vbYesNo
Avatar of military donut

ASKER

AHHH....I gotcha