Return result from Message Box

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Hutch
    New Member
    • Mar 2007
    • 74

    Return result from Message Box

    Ok so i have to following code.
    [code=vb]
    Private Sub Command218_Clic k()
    On Error GoTo Err_218Click

    DoCmd.SendObjec t acSendNoObject, , , "Daveh@specsale s.com", , , "Request for Partition Drawing"
    Me.Text219 = "Waiting on Drawing."
    Exit_218:
    Exit Sub
    Err_218Click:
    GoTo Exit_218

    End Sub
    [/code]
    now before the "Send Object command i want a box to appear and ask if the user is sure they want to send the email. if they click yes then continue with the code, and if they say no to exit the sub command.

    I am decient with If Statements but have no ideal how to incorperate it into a message box.

    Thanks in Advance!
  • MMcCarthy
    Recognized Expert MVP
    • Aug 2006
    • 14387

    #2
    Something like this should work ...

    [CODE=vb]
    Private Sub Command218_Clic k()
    On Error GoTo Err_218Click
    Dim rslt As Integer

    rslt = MsgBox ("Are you sure you want to send this mail", vbYesNo)
    If rslt = vbYes Then
    DoCmd.SendObjec t acSendNoObject, , , "Daveh@specsale s.com", , , "Request for Partition Drawing"
    Me.Text219 = "Waiting on Drawing."
    End If

    Exit_218:
    Exit Sub
    Err_218Click:
    GoTo Exit_218

    End Sub
    [/CODE]

    Comment

    • lee123
      Contributor
      • Feb 2007
      • 556

      #3
      well you could do this

      Code:
      msgbox("Do you want to send the email?",vbyesno + vbquestion,"whats your answer?") = vbyes then
      DoCmd.SendObject acSendNoObject, , , "Daveh@specsales.com", , , "Request for Partition Drawing"
      Me.Text219 = "Waiting on Drawing."
      else
      Exit_218:
      Exit Sub
      Err_218Click:
      GoTo Exit_218

      Comment

      • Hutch
        New Member
        • Mar 2007
        • 74

        #4
        Originally posted by lee123
        well you could do this

        Code:
        msgbox("Do you want to send the email?",vbyesno + vbquestion,"whats your answer?") = vbyes then
        DoCmd.SendObject acSendNoObject, , , "Daveh@specsales.com", , , "Request for Partition Drawing"
        Me.Text219 = "Waiting on Drawing."
        else
        Exit_218:
        Exit Sub
        Err_218Click:
        GoTo Exit_218

        This worked great thank you.

        Comment

        Working...