G
Guest
I want to be able to produce two different emails. one with just standard
financial info on (got this working) and one with additional variation info
on (not working)
i need someone to look at the code i have below and highlight where i have
gone wrong and what needs to be done.
i am using Access 2000 and Outlook 2002.
thanks in advance
Private Sub Form_Open(Cancel As Integer)
'Arvin Meyer 03/12/1999
'Updated 7/21/2001
'ammended by Peter Coxsey 28/06/2007
On Error GoTo Error_Handler
Dim objOutlook As Outlook.Application
Dim objEmail As Outlook.MailItem
'Dim objEmailSub As String
Dim emlAtt As String
Dim emlrcp As String
If Me.Variation_Required = "No" Then
Set objOutlook = CreateObject("Outlook.application")
Set objEmail = objOutlook.CreateItem(olMailItem)
emlrcp = Me.Build_Manager
'emlAtt = form!sub_FAsub_info_frm.Form!File_path
With objEmail
.To = emlrcp
.Subject = "OLO Application " & Me.OLO_REF & ", Site ID " & Me.Site_ID &
", " & Me.Payment_Type
.Body = "Please find attached the signed FA for the above referenced
site." & vbCrLf & _
vbCrLf & _
vbCrLf & _
"The acquisition PO can be receipted to the value of £" &
Me.Agreed_FA_Value_ACQ & vbCrLf & _
vbCrLf & _
"The Build PO can be receipted to the value of £" &
Me.Agreed_FA_Value_Build & vbCrLf & _
vbCrLf & _
Me.Payment_Description & _
vbCrLf & _
vbCrLf & _
vbCrLf & _
"Regards" & vbCrLf & _
vbCrLf & _
vbCrLf & _
"xxxxxxxxxxxx" & vbCrLf & _
"xxxxxxxxxxxxxxxx" & vbCrLf & _
"Mob: xxxxxxxxxxxxxx" & vbCrLf & _
"Email: xxxxxxxxxxxxxx"
'Attachments.Add emlAttachment
'.Attachments.Add "Me.FAsub_info_frm.Form.file_path"
'.Send
.ReadReceiptRequested = True
.Display
End With
Else
'If Me.Variation_Required = "Yes" Then
Set objOutlook = CreateObject("Outlook.application")
Set objEmail = objOutlook.CreateItem(olMailItem)
emlrcp = Me.Build_Manager
'emlAtt = form!sub_FAsub_info_frm.Form!File_path
With objEmail
.To = emlrcp
.Subject = "OLO Application " & Me.OLO_REF & ", Site ID " & Me.Site_ID &
", " & Me.Payment_Type
.Body = "Please find attached the signed FA for the above referenced
site." & vbCrLf & _
"Note that a variation is required to cover all agreed works." & vbCrLf
& _
vbCrLf & _
"The acquisition PO can be receipted to the value of £" &
Me.Acq_Variation & vbCrLf & _
vbCrLf & _
"The Build PO can be receipted to the value of £" & Me.Build_Variation &
vbCrLf & _
vbCrLf & _
"The variation should be raised under " & Me.To_Be_Raised_As & " to the
value of " & Me.Variation_Ammount & vbCrLf & _
"The variation can be receipted to the value of " &
Me.Receipt_Variation_Value & vbCrLf & _
Me.Payment_Description & _
vbCrLf & _
vbCrLf & _
vbCrLf & _
"Regards" & vbCrLf & _
vbCrLf & _
vbCrLf & _
"xxxxxxxxxxx" & vbCrLf & _
"xxxxxxxxxxxxxxxxxxxx" & vbCrLf & _
"Mob: xxxxxxxxxxxx" & vbCrLf & _
"Email: xxxxxxxxxxx"
'Attachments.Add emlAttachment
'.Attachments.Add "Me.FAsub_info_frm.Form.file_path"
'.Send
.ReadReceiptRequested = True
.Display
End With
End If
'End If
Exit_Here:
Set objOutlook = Nothing
Exit Sub
Error_Handler:
MsgBox Err & ": " & Err.Description
Resume Exit_Here
End Sub
financial info on (got this working) and one with additional variation info
on (not working)
i need someone to look at the code i have below and highlight where i have
gone wrong and what needs to be done.
i am using Access 2000 and Outlook 2002.
thanks in advance
Private Sub Form_Open(Cancel As Integer)
'Arvin Meyer 03/12/1999
'Updated 7/21/2001
'ammended by Peter Coxsey 28/06/2007
On Error GoTo Error_Handler
Dim objOutlook As Outlook.Application
Dim objEmail As Outlook.MailItem
'Dim objEmailSub As String
Dim emlAtt As String
Dim emlrcp As String
If Me.Variation_Required = "No" Then
Set objOutlook = CreateObject("Outlook.application")
Set objEmail = objOutlook.CreateItem(olMailItem)
emlrcp = Me.Build_Manager
'emlAtt = form!sub_FAsub_info_frm.Form!File_path
With objEmail
.To = emlrcp
.Subject = "OLO Application " & Me.OLO_REF & ", Site ID " & Me.Site_ID &
", " & Me.Payment_Type
.Body = "Please find attached the signed FA for the above referenced
site." & vbCrLf & _
vbCrLf & _
vbCrLf & _
"The acquisition PO can be receipted to the value of £" &
Me.Agreed_FA_Value_ACQ & vbCrLf & _
vbCrLf & _
"The Build PO can be receipted to the value of £" &
Me.Agreed_FA_Value_Build & vbCrLf & _
vbCrLf & _
Me.Payment_Description & _
vbCrLf & _
vbCrLf & _
vbCrLf & _
"Regards" & vbCrLf & _
vbCrLf & _
vbCrLf & _
"xxxxxxxxxxxx" & vbCrLf & _
"xxxxxxxxxxxxxxxx" & vbCrLf & _
"Mob: xxxxxxxxxxxxxx" & vbCrLf & _
"Email: xxxxxxxxxxxxxx"
'Attachments.Add emlAttachment
'.Attachments.Add "Me.FAsub_info_frm.Form.file_path"
'.Send
.ReadReceiptRequested = True
.Display
End With
Else
'If Me.Variation_Required = "Yes" Then
Set objOutlook = CreateObject("Outlook.application")
Set objEmail = objOutlook.CreateItem(olMailItem)
emlrcp = Me.Build_Manager
'emlAtt = form!sub_FAsub_info_frm.Form!File_path
With objEmail
.To = emlrcp
.Subject = "OLO Application " & Me.OLO_REF & ", Site ID " & Me.Site_ID &
", " & Me.Payment_Type
.Body = "Please find attached the signed FA for the above referenced
site." & vbCrLf & _
"Note that a variation is required to cover all agreed works." & vbCrLf
& _
vbCrLf & _
"The acquisition PO can be receipted to the value of £" &
Me.Acq_Variation & vbCrLf & _
vbCrLf & _
"The Build PO can be receipted to the value of £" & Me.Build_Variation &
vbCrLf & _
vbCrLf & _
"The variation should be raised under " & Me.To_Be_Raised_As & " to the
value of " & Me.Variation_Ammount & vbCrLf & _
"The variation can be receipted to the value of " &
Me.Receipt_Variation_Value & vbCrLf & _
Me.Payment_Description & _
vbCrLf & _
vbCrLf & _
vbCrLf & _
"Regards" & vbCrLf & _
vbCrLf & _
vbCrLf & _
"xxxxxxxxxxx" & vbCrLf & _
"xxxxxxxxxxxxxxxxxxxx" & vbCrLf & _
"Mob: xxxxxxxxxxxx" & vbCrLf & _
"Email: xxxxxxxxxxx"
'Attachments.Add emlAttachment
'.Attachments.Add "Me.FAsub_info_frm.Form.file_path"
'.Send
.ReadReceiptRequested = True
.Display
End With
End If
'End If
Exit_Here:
Set objOutlook = Nothing
Exit Sub
Error_Handler:
MsgBox Err & ": " & Err.Description
Resume Exit_Here
End Sub