eyes59
asked on
load ACCESS 2003 query result into the body of an OUTLOOK 2010 email message
I am trying to have the result of an ACCESS 2003 query load into the subject line & body
of an OUTLOOK 2010 email. The code is below:
Option Compare Database
'------------------------- ---------- ---------- ---------- -----
' Assigned Work
''------------------------ ---------- ---------- ---------- ------
Function AssignedWork()
On Error GoTo AssignedWork_Err
Dim rs As DAO.Recordset
Dim strDate As Date
Dim strCount As Integer
Set rs = CurrentDb.OpenRecordset("Q ryAssigned Wrk")
rs.MoveFirst
Do Until rs.EOF
Loop
strCount = [Wrk_ident]
strDate = Format(Now() - 1, "mm/dd/yyyy")
'send the query result in an email msg
DoCmd.SendObject , "", "", "aName@something.com", "", "", &strCount"-Assigned Work Items on"&strDate, "Assigned Work count is" & strCount&"If you nolonger need this information please contact me. mYname@something.com, False, ""
Set rs = Nothing
DoCmd.SetWarnings False
DoCmd.Quit
AssignedWork_Exit:
Exit Function
AssignedWork _Err:
MsgBox Error$
Resume AssignedWork _Exit
End Function
I want the subject line of the email to read: [strCount] Work Items Assigned on [strDate]
I want the body of the email to read: Assigned Work count is [strCount] for [strDate]. If you nolonger need this information please contact me. myName@something.com.
Two issues occur the first is the loop will not stop, the second is the email is not sent.
Thoughts?
Thank You
of an OUTLOOK 2010 email. The code is below:
Option Compare Database
'-------------------------
' Assigned Work
''------------------------
Function AssignedWork()
On Error GoTo AssignedWork_Err
Dim rs As DAO.Recordset
Dim strDate As Date
Dim strCount As Integer
Set rs = CurrentDb.OpenRecordset("Q
rs.MoveFirst
Do Until rs.EOF
Loop
strCount = [Wrk_ident]
strDate = Format(Now() - 1, "mm/dd/yyyy")
'send the query result in an email msg
DoCmd.SendObject , "", "", "aName@something.com", "", "", &strCount"-Assigned Work Items on"&strDate, "Assigned Work count is" & strCount&"If you nolonger need this information please contact me. mYname@something.com, False, ""
Set rs = Nothing
DoCmd.SetWarnings False
DoCmd.Quit
AssignedWork_Exit:
Exit Function
AssignedWork _Err:
MsgBox Error$
Resume AssignedWork _Exit
End Function
I want the subject line of the email to read: [strCount] Work Items Assigned on [strDate]
I want the body of the email to read: Assigned Work count is [strCount] for [strDate]. If you nolonger need this information please contact me. myName@something.com.
Two issues occur the first is the loop will not stop, the second is the email is not sent.
Thoughts?
Thank You
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
...Nice code there Ron...
Thanks Jeff.
:-)
:-)
ASKER