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

Blank msgBox

P: n/a
I have an email Sub set up that works fine except upon a successful
send I get a blank message box with just an OK button. How can I change
this to read something different? I have no event handler at all set up
yet, but still get the MsgBox... Thanks!

Private Sub SendEmail_Click()

On Error GoTo Err_SendEmail_Click
DoCmd.SendObject acSendNoObject, , , "Jo*****@ABCDE.com", , "Database
maintenance notice", _
"The Sales database can be re-opened and used as normal.", , _
False

Err_Command25_Click:
MsgBox Err.Description

End Sub

What I need is a msgbox that reads: "Notification Sent", vbOKOnly,
"Notification Sent"

Apr 24 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Note: Err_Command25_Click:
Should read: Err_SendEmail_Click:

Apr 24 '06 #2

P: n/a
Parasyke wrote:
I have an email Sub set up that works fine except upon a successful
send I get a blank message box with just an OK button. How can I change
this to read something different? I have no event handler at all set up
yet, but still get the MsgBox... Thanks!


You are getting the blank mailbox because there is nothing telling this
routine to ext the sub. So it goes on until it hits your msgbox - there
is no error, so the msgbox appears with no err.description.

Your code would be better structured this way:

Private Sub SendEmail_Click()

On Error GoTo Err_SendEmail_Click

DoCmd.SendObject acSendNoObject, , , "Jo*****@ABCDE.com", , "Database
maintenance notice", _
"The Sales database can be re-opened and used as normal.", , _
False

Exit_Proc:
Exit Sub

Err_SendEmail_Click:
MsgBox Err.Description
resume Exit_Proc

End Sub

My standard proc exit and error handler goes something like this:

Exit_Proc:

Exit Sub

Err_Proc:

Select Case Err.Number

Case whatever

'handle specific error

Case Else

MsgBox "Error " & Err.Number & " " & Err.Description, _
vbCritical, _
"Name_Of_Procedure", _
Err.HelpFile, Err.HelpContext

Resume Exit_Proc

End Select

--
Tim http://www.ucs.mun.ca/~tmarshal/
^o<
/#) "Burp-beep, burp-beep, burp-beep?" - Quaker Jake
/^^ "Whatcha doin?" - Ditto "TIM-MAY!!" - Me
Apr 24 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.