Hi
I need to send an email order confirmation for when an order is completed to only a handful of people. From the way that my tables have been setup, I cannot add email addresses against people names. I have had a trawl through the excellent archive in this forum and am trying to use the following code. As I only have ~10 internal clients the confirmation needs to go to I thought of using the following:
Option Compare Database
Option Explicit
Private Sub Command53_Click()
On Error GoTo Err_Command56_Click
Dim emailAddress As String
Dim strToWhom As String
Dim strToCCWhom As String
Dim strMsgBody As String
Dim strSubject As String
If Me.Client = "David Moor" Then
emailAddress = "david.moor@sparta.com"
If Me.Client = "Ronald McDonald" Then
emailAddress ="ronald.mcdonald@mcdonalds.com
strSubject = "Your Subject goes here!" & [OrderNumber]
strToWhom = emailAddress
Rem strToCCWhom = "cc address"
strMsgBody = "This email is to "
DoCmd.SendObject , , , strToWhom, strToCCWhom, , strSubject, strMsgBody, True
Exit_Command56_Click:
Exit Sub
Err_Command56_Click:
MsgBox err.Description
Resume Exit_Command56_Click
End If
End if
End Sub
I know the modifications I have "tried" to make on the above code are extremely ugly and some of you are no doubt whincing in pain. Can some kind soul please explain to me why this doesn't work (access doesn't even want to try). I'm still trying to learn VB so any help would be much appreciated.
Thanks
I need to send an email order confirmation for when an order is completed to only a handful of people. From the way that my tables have been setup, I cannot add email addresses against people names. I have had a trawl through the excellent archive in this forum and am trying to use the following code. As I only have ~10 internal clients the confirmation needs to go to I thought of using the following:
Option Compare Database
Option Explicit
Private Sub Command53_Click()
On Error GoTo Err_Command56_Click
Dim emailAddress As String
Dim strToWhom As String
Dim strToCCWhom As String
Dim strMsgBody As String
Dim strSubject As String
If Me.Client = "David Moor" Then
emailAddress = "david.moor@sparta.com"
If Me.Client = "Ronald McDonald" Then
emailAddress ="ronald.mcdonald@mcdonalds.com
strSubject = "Your Subject goes here!" & [OrderNumber]
strToWhom = emailAddress
Rem strToCCWhom = "cc address"
strMsgBody = "This email is to "
DoCmd.SendObject , , , strToWhom, strToCCWhom, , strSubject, strMsgBody, True
Exit_Command56_Click:
Exit Sub
Err_Command56_Click:
MsgBox err.Description
Resume Exit_Command56_Click
End If
End if
End Sub
I know the modifications I have "tried" to make on the above code are extremely ugly and some of you are no doubt whincing in pain. Can some kind soul please explain to me why this doesn't work (access doesn't even want to try). I'm still trying to learn VB so any help would be much appreciated.
Thanks