Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default MsgBox responce If statment

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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 70
Default MsgBox responce If statment

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



Dave wrote:
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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default MsgBox responce If statment

Thank you.

That did the trick

Dave

"Charlotte E." <@ wrote in message
...
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



Dave wrote:
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



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
If statment Cerealkiller via OfficeKB.com Excel Discussion (Misc queries) 5 May 28th 10 10:09 PM
if statment Stuntz Waldorf Excel Worksheet Functions 4 June 24th 09 08:07 PM
IF Statment Momo Excel Worksheet Functions 2 December 6th 08 02:24 PM
Help with If statment pm Excel Discussion (Misc queries) 3 January 29th 08 04:09 PM
if statment Dreamstar_1961 Excel Worksheet Functions 5 April 17th 07 01:30 PM


All times are GMT +1. The time now is 01:53 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"