Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations MikeeOK on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

sending email automatically

Status
Not open for further replies.

asafb

Programmer
Jun 17, 2003
80
US
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?

help!

thank you!
asaf
 
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 (&quot;Error Sending Emails&quot;)
Else
lcComment = &quot;Payments Requiring Approval EMail Sent to &quot; & lcEMailAddress
lcSQLLog = &quot;INSERT INTO tbl_Log (REPORT_TIME,QUERY_NAME,RECORD_COUNT,COMMENTS) &quot;
lcSQLLog = lcSQLLog & &quot;VALUES ('&quot; & lcTime & &quot;','&quot; & lcObjectName & &quot;',&quot; & rs.RecordCount & &quot;,'&quot; & lcComment & &quot;')&quot;
ThisDB.Execute lcSQLLog, dbFailOnError
End If
Else
lcComment = &quot;No Payment Requiring Approval Found. No Email Sent.&quot;
lcSQLLog = &quot;INSERT INTO tbl_Log (REPORT_TIME,QUERY_NAME,RECORD_COUNT,COMMENTS) &quot;
lcSQLLog = lcSQLLog & &quot;VALUES ('&quot; & lcTime & &quot;','&quot; & lcObjectName & &quot;',0,'&quot; & lcComment & &quot;')&quot;
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
&quot;IT Consultant & Web Master&quot;
e-Mail: Stephen_Medvid@GMACM.com

Chester County, PA Residents
Please Show Your Support...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top