Hello, when using teh SendObject command to attach a table as an attachement, etc etc etc, Outlook pops up, anyway to tell outlook to send it automatically?
Here is what I do... I have a NT Scheduled Task open the Access database every 4 hours. I have an Autoexec Macro that calls a Procedure.... Within that procedure I do queries. If queries return any records I send an email automatically. Only requirement is that Outlook Remain open on the PC. Have thought to try Outlook Express, but never got around to it...
...
lcObjectName = "qry_Payments_Need_Approved"
Set rs = ThisDB.OpenRecordset(lcObjectName, dbOpenSnapshot)
If rs.RecordCount <> 0 Then
'E-Mail Report
rs.MoveLast
rs.MoveFirst
llCheck = SendEMailOut(lcEMailAddress, lcSubject, lcMessage, lcObjectType, lcObjectName, lcFormatType)
If llCheck = False Then
MsgBox ("Error Sending Emails"
Else
lcComment = "Payments Requiring Approval EMail Sent to " & lcEMailAddress
lcSQLLog = "INSERT INTO tbl_Log (REPORT_TIME,QUERY_NAME,RECORD_COUNT,COMMENTS) "
lcSQLLog = lcSQLLog & "VALUES ('" & lcTime & "','" & lcObjectName & "'," & rs.RecordCount & ",'" & lcComment & "')"
ThisDB.Execute lcSQLLog, dbFailOnError
End If
Else
lcComment = "No Payment Requiring Approval Found. No Email Sent."
lcSQLLog = "INSERT INTO tbl_Log (REPORT_TIME,QUERY_NAME,RECORD_COUNT,COMMENTS) "
lcSQLLog = lcSQLLog & "VALUES ('" & lcTime & "','" & lcObjectName & "',0,'" & lcComment & "')"
ThisDB.Execute lcSQLLog, dbFailOnError
End If
...
Public Function SendEMailOut(lcEM, lcSUBJ, lcMess, lcObjType, lcObjName, lcFormat) As Boolean
On Error GoTo Err_SendEMailOut
DoCmd.SendObject acSendQuery, lcObjName, acFormatXLS, lcEM, , , lcSUBJ, lcMess, False
SendEMailOut = True
Exit_SendEMailOut:
Exit Function
Err_SendEMailOut:
SendEMailOut = False
MsgBox Err.DESCRIPTION
Resume Exit_SendEMailOut
End Function
Steve Medvid
"IT Consultant & Web Master"
e-Mail: Stephen_Medvid@GMACM.com
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.