Auto email report

M

Mike

I posted this earlier in another thread, but I suspect that no one saw it
since the thread was 3 years old. I appologize if I have factured the groups
netequette by posting it again.

I am attempting to have a report automatically emailed using the scheduler.
I found code to automatically print a report in an earlier post and I am
trying to modify it to suit my needs. Here is the code:


On error resume next
call RunReport("database.mdb","OpenIssues","c:\OpenIssues.snp","Snapshot
Format")

Function RunReport(strDbPathAndName,strRptName,strDocPath,strDocFmt)
On Error Resume Next
Dim objDb
Set objDb = CreateObject("Access.Application")
objDb.Visible=True
objDb.OpenCurrentDatabase (strDbPathAndName)
objDb.DoCmd.SendObject acSendReport, strRptName, strDocFmt, "(e-mail address removed)", , ,
"Open Issues Report",,True
DoEvents
objDb.CloseCurrentDatabase
objDb.Quit
End Function

When the script is run, the database opens, but no email is generated. the
sendobject command works when applied to a command button in access, but
seems to do nothing here.

Any Ideas would be greatly appreciated,
Mike
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top