CharlesDavenport
New member
- Local time
- Today, 22:01
- Joined
- Dec 7, 2020
- Messages
- 26
OK I have the below VBA to send a report but Im getting a syntax error on the DoCmd.Send.Object and trying to work out where ive gone wrong!
Ive had to list out all of the variables so that I can take the email address from a table of employee names based on the name on a form and ive gone wrong somewhere and ive been staring at this for so long i cant see the mistake!
Any assistance is appreciated.
Ive had to list out all of the variables so that I can take the email address from a table of employee names based on the name on a form and ive gone wrong somewhere and ive been staring at this for so long i cant see the mistake!
Any assistance is appreciated.
Code:
Private Sub Submit_Click()
If (Forms!PersonalConflict!Check166.Value = -1) Then
DoCmd.RunCommand acCmdSaveRecord
'-----------------------------------------------------
On Error GoTo 0
Dim InsOwner As String
InsOwner = DLookup("[Email]", "[Employee Names]", "[Employee Name] = '" & Me.Text405 & "'")
Dim emailTo As String
emailTo = "& InsOwner & ; Charles.davenport@.co.uk "
DoCmd.SendObject ObjectType:=acSendForm, ObjectName:=Forms![PersonalConflictPrint], OutputFormat:=acFormatPDF, To:=emailTo, CC:="", BCC:="", Subject:="NEW PERSONAL CONFLICT INFORMATION SUBMITTED", MessageText:="Please review the attached Personal Conflict Information for new client.", EditMessage:=False,
End If
End Sub