Run-time error 2059 -Where Is Wrong In This Code?

Ashfaque

Search Beautiful Girls from your town for night
Local time
Today, 23:22
Joined
Sep 6, 2004
Messages
894
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..
 
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
 
you specify a Report for output.
do you have report "T_IssuedWarnings"?
 
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.
 
You might also want to
Code:
Debug.Print sMsg
 
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

Back
Top Bottom