front.desk
Registered User.
- Local time
- Today, 02:37
- Joined
- Oct 11, 2011
- Messages
- 12
Hi, I have been searching through this and many forums to get an idea of what I need. I had literally never seen Access before this task got handed to me last week!
I need to generate automatic email reminders for due dates. From what I can figure it is easiest if I make it all work on a button/click feature rather than a timer, which is fine for now. My main issue right now is that I found a code in a forum that seems like it should work for what I am trying to do. I have a query that separates out the Due Dates that are approaching. The problem now is that the code I have in a module says it has "Invalid Outside Procedure" (After I close the error message it highlights the word SET)
I got the code from a post on this forum: 775884#post775884
Please help!
Dim MyDb As DAO.Database
Dim rsEmail As DAO.Recordset
Dim sToName As String
Dim sSubject As String
Dim sMessageBody As String
Set MyDb = CAPADb()
Set rsEmail = MyDb.OpenRecordset("qryDueDate", dbOpenSnapshot)
With rsEmail
.MoveFirst
Do Until rsEmail.EOF
If IsNull(.Fields(11)) = False Then
sToName = .Fields(11)
sSubject = "Open Action Item: " & .Fields(6)
sMessageBody = "Email Body Text " & vbCrLf & _
"Field 6: " & .Fields(6) & vbCrLf & _
"Field 7: " & .Fields(7) & vbCrLf & _
"Field 24: " & .Fields(24)
docmd.SendObject acSendNoObject, , , _
sToName, , , sSubject, sMessageBody, False, False
End If
.MoveNext
Loop
End With
Set MyDb = Nothing
Set rsEmail = Nothing
I need to generate automatic email reminders for due dates. From what I can figure it is easiest if I make it all work on a button/click feature rather than a timer, which is fine for now. My main issue right now is that I found a code in a forum that seems like it should work for what I am trying to do. I have a query that separates out the Due Dates that are approaching. The problem now is that the code I have in a module says it has "Invalid Outside Procedure" (After I close the error message it highlights the word SET)
I got the code from a post on this forum: 775884#post775884
Please help!
Dim MyDb As DAO.Database
Dim rsEmail As DAO.Recordset
Dim sToName As String
Dim sSubject As String
Dim sMessageBody As String
Set MyDb = CAPADb()
Set rsEmail = MyDb.OpenRecordset("qryDueDate", dbOpenSnapshot)
With rsEmail
.MoveFirst
Do Until rsEmail.EOF
If IsNull(.Fields(11)) = False Then
sToName = .Fields(11)
sSubject = "Open Action Item: " & .Fields(6)
sMessageBody = "Email Body Text " & vbCrLf & _
"Field 6: " & .Fields(6) & vbCrLf & _
"Field 7: " & .Fields(7) & vbCrLf & _
"Field 24: " & .Fields(24)
docmd.SendObject acSendNoObject, , , _
sToName, , , sSubject, sMessageBody, False, False
End If
.MoveNext
Loop
End With
Set MyDb = Nothing
Set rsEmail = Nothing