fill out email msg

jessiep

New member
Local time
Yesterday, 23:56
Joined
Jul 6, 2006
Messages
7
In a form I have created a button to send an email. I am trying to write code to fill out the email fields To, Subject, and Body
The information on who to send the email to is on the Form how do I take that information and lookup the email address. Also i need to lookup the First/Last Name to put in the body of the email. The code that i have is getting an error "You entered an invalid argument in a domain aggregate function"

MainTable
TaskID -AutoNumber
Status - Memo
OnTarget - Yes/No
Expected Completion Date - Date/Time
POC - Number
Description - Text

Employees
POC - AutoNumber
LastName - Text
FirstName - Text
EmailAddress -Text

Code that I have :

Dim stDocName As String
Dim stText As String
Dim stTicketID As String '-- The ticket ID from form
Dim stHelpDesk As String '-- Person who assigned ticket
Dim stWho As String '-- Reference to tblUsers
Dim stWhere As String '-- Criteria for DLookup
Dim varTo As Variant '-- Address for SendObject
Dim AssignBy As String
Dim RecDate As Variant '-- Rec date for e-mail text

'' Date Assigned
RecDate = Me.Date_Assigned
stWho = Me.POC
stTicketID = Format(Me.TaskID, "00000")
strHelpDesk = Me.Combo22
AssignBy = DLookup("[LastName]", Employees, Me.Combo22)
''stWhere = "Employees.EmployeeID = " & "'" & stWho & "'"


stText = "You have been assigned a new ticket." & Chr$(13) & Chr$(13) & _
"Ticket number: " & stTicketID & Chr$(13) & _
"This ticket has been assigned to you by: " & AssignBy & Chr$(13) & _
"Received Date: " & RecDate & Chr$(13) & Chr$(13) & _
"This is an automated message. Please do not respond to this e-mail."
stDocName = "MainTable"
DoCmd.SendObject acSendReport, stDocName, acFormatRTF, , , , "New Task Given", stText


Jessie
 
Last edited:

Users who are viewing this thread

Back
Top Bottom