I have an order form and I want users to be able to email selected information from this form to the supplier when they have completed the order entry, I have found some code which I have adapted, but when I click on the command button to run this code I get Argument Not Optional with the name of the module routine highlighted. Does this mean my code below is wrong or the code in the module does not see the information (I think) I am collecting, or is this name not supposed to be the name of the module routine.
This is the first time I have ever tried to email information from Access via code so any help gratefully received.
Private Sub EmailJob_Click()
Dim strMsgAddress As String
Dim strSubject As String
Dim strBody As String
'code to send email with job details
DoCmd.RunCommand acCmdSaveRecord
strMsgAddress = Forms!frmOrders.me.ContEmail
strSubject = "Purchase Order Number : CC " & Forms!frmOrders.me.OrderID
strBody = "Please arrange for delivery of the following order." _
& "The purchase order number that must be quoted on all correspondence is: " & vbCrLf & "Purchase Order Number: CC" & Forms!frmOrders.me.OrderID& _
& vbCrLf & "If you have any queries please contact " & Forms!frmOrders.me.CoContact& _
& "at Darrow Road on" _
& Forms!frmOrders.me.CoTelephone
If Not IsNull(Forms!frmOrders.me.ItemDescription) And Not IsNull(Forms!frmOrders.me.ItemQty) And Not IsNull(Forms!frmOrders.me.LineTotalExcVat) Then strBody = strBody & vbCrLf & Forms!frmOrders.me.ItemDescription & " " & Forms!frmOrders.me.ItemQty & " " & Forms!frmOrders.me.LineTotalExcVat _
CreateOrdersEmail strMsgAddress, strSubject, strBody
End Sub
This is the first time I have ever tried to email information from Access via code so any help gratefully received.
Private Sub EmailJob_Click()
Dim strMsgAddress As String
Dim strSubject As String
Dim strBody As String
'code to send email with job details
DoCmd.RunCommand acCmdSaveRecord
strMsgAddress = Forms!frmOrders.me.ContEmail
strSubject = "Purchase Order Number : CC " & Forms!frmOrders.me.OrderID
strBody = "Please arrange for delivery of the following order." _
& "The purchase order number that must be quoted on all correspondence is: " & vbCrLf & "Purchase Order Number: CC" & Forms!frmOrders.me.OrderID& _
& vbCrLf & "If you have any queries please contact " & Forms!frmOrders.me.CoContact& _
& "at Darrow Road on" _
& Forms!frmOrders.me.CoTelephone
If Not IsNull(Forms!frmOrders.me.ItemDescription) And Not IsNull(Forms!frmOrders.me.ItemQty) And Not IsNull(Forms!frmOrders.me.LineTotalExcVat) Then strBody = strBody & vbCrLf & Forms!frmOrders.me.ItemDescription & " " & Forms!frmOrders.me.ItemQty & " " & Forms!frmOrders.me.LineTotalExcVat _
CreateOrdersEmail strMsgAddress, strSubject, strBody
End Sub