coolcatkelso
Registered User.
- Local time
- Today, 19:33
- Joined
- Jan 5, 2009
- Messages
- 279
Hey guys
I was searching around and found this topic - http://www.access-programmers.co.uk/forums/showthread.php?t=111046
I took a look and managed to get it working, it sends an email using my BT Yahoo account without anyone knowing, no outlook or other client.. Now I can send a daily report from my distrubuted Dbase
great I can spy on my customers and see what they are doing lol joking
Anyway, I was wondering how I could attach a report to this?
Here is the code that is the "Send Button"
Obvisouly I tried the standard access code - DoCmd.SendObject , acSendReport, "Absent Employees"
but as you can guess, it brought up outlook? Any other way to add a report in without having to save it and add as attachment?
________
Kitchen Measures
I was searching around and found this topic - http://www.access-programmers.co.uk/forums/showthread.php?t=111046
I took a look and managed to get it working, it sends an email using my BT Yahoo account without anyone knowing, no outlook or other client.. Now I can send a daily report from my distrubuted Dbase

Anyway, I was wondering how I could attach a report to this?
Here is the code that is the "Send Button"
Code:
Private Sub cmdSend_Click()
If Trim(txtServer) = "" Then
MsgBox "Enter the server name or IP address"
txtServer.SetFocus
Exit Sub
ElseIf Trim(txtMailFrom) = "" Then
MsgBox "Enter the sender e-mail address"
txtMailFrom.SetFocus
Exit Sub
ElseIf Trim(txtSendTo) = "" Then
MsgBox "Enter the recipient e-mail address"
txtSendTo.SetFocus
Exit Sub
ElseIf cmbAuth.ListIndex = 1 And Trim(txtPOPServer) = "" Then
MsgBox "POP Authentication requires POP server"
txtPOPServer.SetFocus
Exit Sub
End If
If Trim(txtMessageSubject) = "" Then
If MsgBox("You didn't enter the message subject. " & vbCrLf & _
"Would you like to send it anyway?", vbYesNo) = vbNo Then Exit Sub
End If
If Trim(txtMessageText) = "" Then
If MsgBox("You didn't enter the message text. " & vbCrLf & _
"Would you like to send it anyway?", vbYesNo) = vbNo Then Exit Sub
End If
' txtStatus.SetFocus
With oSMTP
'authentication
If cmbAuth.ListIndex > 0 Then
.username = txtUsername
.password = txtPassword
End If
If cmbAuth.ListIndex = 1 Then .POPServer = txtPOPServer
.AuthenticationType = cmbAuth.ListIndex
.Server = txtServer
.MailFrom = txtMailFrom
.SendTo = txtSendTo
.MessageSubject = txtMessageSubject
.MessageText = txtMessageText
If Me.Text40 > "" Then
.Attachments.Add Me.Text40
End If
If Me.Text44 > "" Then
.Attachments.Add Me.Text44
End If
If Me.Text47 > "" Then
.Attachments.Add Me.Text47
End If
.SendEmail
End With
End Sub
Obvisouly I tried the standard access code - DoCmd.SendObject , acSendReport, "Absent Employees"
but as you can guess, it brought up outlook? Any other way to add a report in without having to save it and add as attachment?
________
Kitchen Measures
Last edited: