Run-time error 2059 -Where Is Wrong In This Code? (1 Viewer)

Ashfaque

Student
Local time
Today, 08:11
Joined
Sep 6, 2004
Messages
732
Hi,

I m planing to send pdf report to employee by email. The mid part of my code is producing run-time error-2059

DoCmd.SendObject acSendReport, "T_IssuedWarnings", acFormatPDF, strMailList, StrCC, , "WARNING LETTER - " & WLetterRef & _
" - " & CName & " - " & Format(Now()), "Dear " & CName & "," & vbCr & vbCr & "With reference to the subject, " & _
" disciplinary action has been taken against you. The details are attached." & vbCr & vbCr & "If you have to " & _
"to say, you may visit to HR office. please sign and re-send back to us as your acceptance." & vbCr & vbCr & "Regards," & _
vbCr & vbCr & "Sincerely," & vbCr & vbCr & "John Smith" & vbCr & "Human Resources Dept.", True

OFFER LETTER Cannot find the object 'I1'.

Can someone help me please..
 

Minty

AWF VIP
Local time
Today, 03:41
Joined
Jul 26, 2013
Messages
8,198
Split out your message into a variable to make your code easier to read and debug;

Code:
Dim sMsg as String

sMsg = "WARNING LETTER - " & WLetterRef & _
" - " & CName & " - " & Format(Now()), "Dear " & CName & "," & vbCr & vbCr & "With reference to the subject, " & _
" disciplinary action has been taken against you. The details are attached." & vbCr & vbCr & "If you have to " & _
"to say, you may visit to HR office. please sign and re-send back to us as your acceptance." & vbCr & vbCr & "Regards," & _
vbCr & vbCr & "Sincerely," & vbCr & vbCr & "John Smith" & vbCr & "Human Resources Dept."

DoCmd.SendObject acSendReport, "T_IssuedWarnings", acFormatPDF, strMailList, StrCC, ,sMsg , True
I suspect this will lead you to your problem
 

arnelgp

error reading drive A:
Local time
Today, 10:41
Joined
May 7, 2009
Messages
12,064
you specify a Report for output.
do you have report "T_IssuedWarnings"?
 

Ashfaque

Student
Local time
Today, 08:11
Joined
Sep 6, 2004
Messages
732
Oh..Thank you Minty and Arnel,

First I have splitted the code to make it easy. Thats good way.

Thanks Arnel for pointing me to report name I checked the report name and corrected.. It is done and working now.
 

Gasman

Enthusiastic Amateur
Local time
Today, 03:41
Joined
Sep 21, 2011
Messages
7,906
You might also want to
Code:
Debug.Print sMsg
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Yesterday, 21:41
Joined
Feb 28, 2001
Messages
19,411
For future reference, many times I have seen that '|1' message. All it means is that SQL tried and failed to find one of the fields named in the SELECT, JOIN...ON, WHERE, ORDER BY, GROUP BY, or HAVING clauses - any place where a field name is permitted.

It usually occurs either because the field name was spelled wrong or because the field so named is contained in something that needed to be open at the time, but wasn't. Those two reasons would cover about 99% of the cases, I think.
 

Users who are viewing this thread

Top Bottom