Here is what I am trying to do. I have a form, which feeds a table. I am using it to track cadavers for a mobile lab we are doing. Each record on my form represents a single cadaver used in our lab. There will be multiple for any given day. Each record contains the name of the person in charge of the territory where the lab is being held. So, the same person will be in charge of a lab that may span 8 records or so. Hope this makes sense. So, I want to automate (using a command button) an email that gets sent out once a month, to each rep listing the cadavers used during their labs. I've been mulling over this for days. If I write a query that prompts for a date range, I can pull all of the records through by rep, but how would I automatically have it group by rep and send out only that reps records, all in one email? Originally, I was doing the automation record by record from the form, using this code:
Private Sub Command66_Click()
Dim stLinkCriteria As String
Dim Subject As String
Dim Text As String
Dim Message As String
If IsNull([RepEmail1]) Or ([RepEmail1]) = "" Then MsgBox "There is no E-mail address entered for this person!"
Exit Sub
Else
stLinkCriteria = Me![RepEmail1]
stSubject = "Mobile Lab Cadaver Disposal Fee"
stText = "Test"
DoCmd.SendObject acSendNoObject, , , stLinkCriteria, , , stSubject, stText
End If
I understand code, but not well enough to write it without serious help. I am going crazy here. Can someone give me some advice?
Private Sub Command66_Click()
Dim stLinkCriteria As String
Dim Subject As String
Dim Text As String
Dim Message As String
If IsNull([RepEmail1]) Or ([RepEmail1]) = "" Then MsgBox "There is no E-mail address entered for this person!"
Exit Sub
Else
stLinkCriteria = Me![RepEmail1]
stSubject = "Mobile Lab Cadaver Disposal Fee"
stText = "Test"
DoCmd.SendObject acSendNoObject, , , stLinkCriteria, , , stSubject, stText
End If
I understand code, but not well enough to write it without serious help. I am going crazy here. Can someone give me some advice?