MsgBox responce If statment

D

Dave

seems I can't get an IF statement based upon the response from a msgbox
function

This is what I have

Code:
MsgBox "This will delete all information on this caller" & vbLf & _
"Are you sure you want to do this", vbYesNo
If vbYesNo = Yes Then
Me.FirstName.Value = ""
Me.LastName.Value = ""
Me.Caller.Value = ""

Else
Exit Sub
End If
Me.Status = 4
DoCmd.Close

If I hit YES it does not delete the info.

should the IF statement be true/false or 0/1 instead of Yes/No?

Is the MsgBox written wrong?

Any help here will be appreciated.

Thanks in advance
dave
 
C

Charlotte E.

Try this:


If MsgBox("This will delete all information on this caller" & vbLf & "Are
you sure you want to do this", vbYesNo) = vbYes then
Me.FirstName.Value = ""
Me.LastName.Value = ""
Me.Caller.Value = ""
Else
Exit Sub
End If
 
D

Dave

Thank you.

That did the trick

Dave

Charlotte E. said:
Try this:


If MsgBox("This will delete all information on this caller" & vbLf & "Are
you sure you want to do this", vbYesNo) = vbYes then
Me.FirstName.Value = ""
Me.LastName.Value = ""
Me.Caller.Value = ""
Else
Exit Sub
End If


seems I can't get an IF statement based upon the response from a
msgbox function

This is what I have

Code:
MsgBox "This will delete all information on this caller" &
vbLf & _ "Are you sure you want to do this", vbYesNo
If vbYesNo = Yes Then
Me.FirstName.Value = ""
Me.LastName.Value = ""
Me.Caller.Value = ""

Else
Exit Sub
End If
Me.Status = 4
DoCmd.Close

If I hit YES it does not delete the info.

should the IF statement be true/false or 0/1 instead of Yes/No?

Is the MsgBox written wrong?

Any help here will be appreciated.

Thanks in advance
dave
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top