Msg Box Problem

expublish

Registered User.
Local time
Today, 21:19
Joined
Feb 22, 2002
Messages
121
It is not so much a problem as a query. I have a form where the user fills out a couple of fields and clicks a button and an e-mail is sent to a load of recipients. My query is nothing to do with this however.

When the user clicks the send button I would like them to be prompted with a message box asking them

"To send your message to all records on file click OK. If you do not want to do this click Cancel."

and then in the message box there is an OK button that carries on the command button action and a cancel button that stops the action and returns back to the form.

My code currently looks like:

Code:
Private Sub Command0_Click()
On Error Resume Next
Dim rsEmail As DAO.Recordset
Dim strEmail As String
Set rsEmail = CurrentDb.OpenRecordset("email list")
Do While Not rsEmail.EOF
strEmail = rsEmail.Fields("E-mail").Value
DoCmd.SendObject , , , strEmail, , , _
Me.subject, Me.message, False
rsEmail.MoveNext
Loop
Set rsEmail = Nothing
Dim intPrompt As Integer
intPrompt = MsgBox("Messages Sent" & vbCrLf & vbCrLf_ & "Press OK to continue", vbOKOnly, "Confirmation")
DoCmd.Close acForm, "email"
End Sub

Thanks in advance,

Scott.
 
Dim strMsg as String

StrMsg = "To send your message to all records on file click OK. If you do not want to do this click No"

if msgbox(strmsg, vbYesno, "Send message?") = vbYes then

'Code for yes goes here

Else

Exit sub

end if

[This message has been edited by Jimbob (edited 04-22-2002).]
 
Brilliant, thank you - works great.
 

Users who are viewing this thread

Back
Top Bottom