General discussion

Locked

Access and Auto e-mail

By AndyN ·
Greetings All

Here's my problem. I need to automatically e-mail files as attachments.
The problem is that the file locations are stored in the results of an Access 97 query, I need some way of interogating the results and pick up the file names and e-mail addresses to which to send them. This would need to run every day at the same time automatically.
My Access knowledge is limited so weather this is a plug in option or not I have no idea. Or even if it's possible.

Regards
Andy

This conversation is currently closed to new comments.

2 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Collapse -

by IT_Cowboy In reply to Access and Auto e-mail

This is certainly possible, however there is no plugin or wizard that I am aware of that will assist you with this. You would need to engage someone with advanced MS Access programming skills and have something specifically written.

Collapse -

by timfox In reply to Access and Auto e-mail

Andy - it's time to step up. Your question involves a reasonable bit of programming, but here goes...

Don't worry about the timing of these events. Let's just say that you want Access to run the query and send the emails when you click a certain button on a form. OK - now put this code behind the button's OnClick event:

Private sub cmdThisButton_OnClick
dim strEmailStuff as string
dim rstEmailStuff as recordset

strEmailStuff = "SELECT EmailAddress, FileLocation from tblThisTable"
set rstEmailStuff = currentdb.openrecordset(strFileName)
if rstEmailStuff.recordcount > 0 then
rstEmailStuff.movefirst
While rst.EmailStuff not EOF
SendEmailToWith rstEmailStuff.fields("EmailAddress") rstEmailStuff.fields.("FileLocation")
Wend
end if
set rstEmailStuff = nothing

OK - now you have to define the content of the 'SendEmailToWith' function, like this

Private function SendEmailToWith (strEmailTo as string, strFileAttachment as string)

<time to do some work>

End function

To fill the middle bit - have a look at the following web site and use the code already developed for sending email from MS Access:
http://www.granite.ab.ca/access/email.htm
...or use the SendMail function if you really want to. We can get to the "run every day at the same time automatically" another time. Just try to get the button working.

All the best.
TimFox

Back to Software Forum
2 total posts (Page 1 of 1)  

Related Discussions

Related Forums