With help of Capricorn1 I have just managed to get a report to open as a PDF.
What I need to do now is work out a way of instead of the report opening i want it to be sent as an atachment to an email. I want this to happen automatically. so when you you press a comand buttone it opens up outlook and inputs the clients email address automatically and adds the PDF automatically leaving me to just press send.
I currently send emails in my access without using outlook. i use my own code and by pass outlook.
it maybe easier and better for me if i can get my email form to do this. the core code for this form is:
Dim iAnswer As Integer
If cmbAuth.ListIndex > 0 Then
.username = txtUsername
.password = txtPassword
If cmbAuth.ListIndex = 1 Then .POPServer = txtPOPServer
.AuthenticationType = cmbAuth.ListIndex
.Server = txtServer
.MailFrom = txtMailFrom
.sendto = txtSendTo
.MessageSubject = txtMessageSubject
.MessageText = txtMessageText
.MessageHTML = htmlbody
BELOW is the code which when you press a command button opens the report as a PDF. it is this code i need to change so it can send it as email instead.
Private Sub Command1136_Click()
Dim blRet As Boolean
Dim tr As Long
Dim stDocName, strWhere As String
strWhere = "DMPClientID=" & Me!DMPClientID
DoCmd.OpenReport "rptDMPFinancialStatementBlank", acPreview, , strWhere
tr = rsModify
tr = tr Or rsPrint
tr = tr Or rsCopyObj
blRet = ConvertReportToPDF("rptDMPFinancialStatementBlank", vbNullString, _
"rptDMPFinancialStatementBlank" & ".pdf", False, True, 150, "", "DEF", tr, 0)
DoCmd.Close acReport, "rptDMPFinancialStatementBlank"