By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,395 Members | 1,368 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,395 IT Pros & Developers. It's quick & easy.

Return result from Message Box

P: 74
Ok so i have to following code.
Expand|Select|Wrap|Line Numbers
  1. Private Sub Command218_Click()
  2. On Error GoTo Err_218Click
  3.  
  4. DoCmd.SendObject acSendNoObject, , , "Daveh@specsales.com", , , "Request for Partition Drawing"
  5. Me.Text219 = "Waiting on Drawing."
  6. Exit_218:
  7. Exit Sub
  8. Err_218Click:
  9. GoTo Exit_218
  10.  
  11. End Sub
  12.  
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!
Sep 7 '07 #1
Share this Question
Share on Google+
3 Replies


MMcCarthy
Expert Mod 10K+
P: 14,534
Something like this should work ...

Expand|Select|Wrap|Line Numbers
  1. Private Sub Command218_Click()
  2. On Error GoTo Err_218Click
  3. Dim rslt As Integer
  4.  
  5.     rslt = MsgBox ("Are you sure you want to send this mail", vbYesNo)
  6.     If rslt = vbYes Then
  7.         DoCmd.SendObject acSendNoObject, , , "Daveh@specsales.com", , , "Request for Partition Drawing"
  8.         Me.Text219 = "Waiting on Drawing."
  9.     End If
  10.  
  11. Exit_218:
  12.     Exit Sub
  13. Err_218Click:
  14.     GoTo Exit_218
  15.  
  16. End Sub
  17.  
Sep 7 '07 #2

lee123
100+
P: 556
well you could do this

Expand|Select|Wrap|Line Numbers
  1. msgbox("Do you want to send the email?",vbyesno + vbquestion,"whats your answer?") = vbyes then
  2. DoCmd.SendObject acSendNoObject, , , "Daveh@specsales.com", , , "Request for Partition Drawing"
  3. Me.Text219 = "Waiting on Drawing."
  4. else
  5. Exit_218:
  6. Exit Sub
  7. Err_218Click:
  8. GoTo Exit_218
Sep 7 '07 #3

P: 74
well you could do this

Expand|Select|Wrap|Line Numbers
  1. msgbox("Do you want to send the email?",vbyesno + vbquestion,"whats your answer?") = vbyes then
  2. DoCmd.SendObject acSendNoObject, , , "Daveh@specsales.com", , , "Request for Partition Drawing"
  3. Me.Text219 = "Waiting on Drawing."
  4. else
  5. Exit_218:
  6. Exit Sub
  7. Err_218Click:
  8. GoTo Exit_218

This worked great thank you.
Sep 14 '07 #4

Post your reply

Sign in to post your reply or Sign up for a free account.