Hi,
I've got a vba code written which adds data entered in an input form to a table. On the back of this I also require an email to be written and opended via outlook to a recipient value in a combo box. The issue i am having is linking the codes together, I've tried calling the other module but it's running and skipping it. Code is below (red is the part I am calling, the message box is working but not the email part of the code)
Private Sub submitdispute_Click()
Dim db As Database
Dim rec As Recordset
Set db = CurrentDb
Set rec = db.OpenRecordset("Select * from BackOfficeDisputeWarehouse")
rec.AddNew
rec("Company") = Me.company
rec("MonthNo") = Me.month
rec("DateTimeofDispute") = Me.datetime
rec("DateofDispute") = Me.date
rec("ProcessingDate") = Me.ProcessingDate
rec("ReferenceNo") = Me.reference
rec("QA") = Me.QA
rec("SQA") = Me.sqa
rec("Department") = Me.Department
rec("Workstream") = Me.Workstream
rec("SubWorkstream") = Me.SubWorkstream
rec("FLM") = Me.flm
rec("PC") = Me.pc
rec("Agent") = Me.agent
rec("InvestigationDispute") = Me.Inv
rec("InvestigationDisputeComments") = Me.invcomments
rec("CustomerDispute") = Me.Cus
rec("CustomerDisputeComments") = Me.cuscomments
rec("BusinessDispute") = Me.Bus
rec("BusinessDisputeComments") = Me.buscomments
rec("AccountManagementDispute") = Me.Acc
rec("AccountManagementDisputeComments") = Me.acccomments
Call SendEmail
End Sub
Private Sub SendEmail()
Dim oApp As Outlook.Application
Dim oMail As MailItem
Set oApp = CreateObject("Outlook.application")
Set oMail = oApp.CreateItem(olMailItem)
oMail.Body = "TEST BODY"
oMail.Subject = "Test Subject"
oMail.To = Me.sqaemail
oMail.CC = Me.qmemail
MsgBox ("Dispute Raised")
End Sub
I've got a vba code written which adds data entered in an input form to a table. On the back of this I also require an email to be written and opended via outlook to a recipient value in a combo box. The issue i am having is linking the codes together, I've tried calling the other module but it's running and skipping it. Code is below (red is the part I am calling, the message box is working but not the email part of the code)
Private Sub submitdispute_Click()
Dim db As Database
Dim rec As Recordset
Set db = CurrentDb
Set rec = db.OpenRecordset("Select * from BackOfficeDisputeWarehouse")
rec.AddNew
rec("Company") = Me.company
rec("MonthNo") = Me.month
rec("DateTimeofDispute") = Me.datetime
rec("DateofDispute") = Me.date
rec("ProcessingDate") = Me.ProcessingDate
rec("ReferenceNo") = Me.reference
rec("QA") = Me.QA
rec("SQA") = Me.sqa
rec("Department") = Me.Department
rec("Workstream") = Me.Workstream
rec("SubWorkstream") = Me.SubWorkstream
rec("FLM") = Me.flm
rec("PC") = Me.pc
rec("Agent") = Me.agent
rec("InvestigationDispute") = Me.Inv
rec("InvestigationDisputeComments") = Me.invcomments
rec("CustomerDispute") = Me.Cus
rec("CustomerDisputeComments") = Me.cuscomments
rec("BusinessDispute") = Me.Bus
rec("BusinessDisputeComments") = Me.buscomments
rec("AccountManagementDispute") = Me.Acc
rec("AccountManagementDisputeComments") = Me.acccomments
Call SendEmail
End Sub
Private Sub SendEmail()
Dim oApp As Outlook.Application
Dim oMail As MailItem
Set oApp = CreateObject("Outlook.application")
Set oMail = oApp.CreateItem(olMailItem)
oMail.Body = "TEST BODY"
oMail.Subject = "Test Subject"
oMail.To = Me.sqaemail
oMail.CC = Me.qmemail
MsgBox ("Dispute Raised")
End Sub