squidly Posted June 19, 2010 Posted June 19, 2010 (edited) Hello all, I am attempting to email some Access reports using the _INetSmtpMailCom function. My script connects to a db, compiles the email list from a query, and then I need to attach a report, which is where I am getting hung up. I can compile the email list, and execute an email without said attachment. Here is a sample script I used to get started... Local $oRS Local $oConn $tempfile = @TempDir & '\Emaillist.txt' $location = @ScriptDir & "\MyDatabase.mdb" If FileExists($tempfile) then FileDelete($tempfile) $oConn = ObjCreate("ADODB.Connection") $oRS = ObjCreate("ADODB.Recordset") $oConn.Open("Driver={Microsoft Access Driver (*.mdb)};Dbq="&$location) $oRS.Open("Select * FROM Table1", $oConn, 1, 3) $oRS.MoveFirst ;Used to compile the email list from Table1 For $iIndex = 1 To $oRS.RecordCount IF $oRS.Fields("Checkbox1").value = -1 Then $message = $oRS.Fields("Email").value FileWriteLine($tempfile,$message) EndIf $oRS.MoveNext Next $oConn.Close $oConn = 0 I also included the sample db. Anyway to save the .snp file to the tempdir? Thanks in advance!MyDatabase.zip Edited June 19, 2010 by squidly
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now