pdfformat

Lanason

Registered User.
Local time
Today, 21:19
Joined
Sep 12, 2003
Messages
258
here is an odd one ......

this works
DoCmd.SendObject acReport, ReportName, acFormatPDF, SendTo, SendCc, SendBcc, Subject, Message, True, ""

but this doesn't

Dim MailFormat As String
MailFormat = myrec![MailFormat] ' MsgBox MailFormat

DoCmd.SendObject acSendReport, StDocName, MailFormat, MailTo, MailCC, MailBcc, Subject, MailGreeting & " " & MailMessage & " " & MailSignature, True

where I get the format from a table as a variable

error message is that format not available

any ideas :banghead::banghead:
 
That's because it's not a string, I think its a vba constant that equates to a number.

In the immediate window type ? followed by the string without quotes and see what it returns.
 
'Format must be one of the numeric values , acFormatRTF, acFormatXLS...etc

vFormat = acFormatPDF
docmd.SendObject acSendReport,"rptMyRpt",vFormat,sTo, ,,sSubj,sText,false
 
Ranman, actually with this method, it is a string.

Try ? acFormatRTF in the immediate window (or searching the object browser) and you'll get

Rich Text Format (*.rtf)

Consequently, unless myrec![MailFormat] has this text surrounded in double quotes, it has to be included in the SendObject statement, viz

DoCmd.SendObject acSendReport, StDocName, chr(34) & MailFormat & chr(34), MailTo, MailCC, MailBcc, Subject, MailGreeting & " " & MailMessage & " " & MailSignature, True
 
thank you chaps - i will try this tomorrow
 
still says "the format you are trying to output the current object is not available"

strange but true - (access 2010 by the way)
 
try is with another format besides acFormatPDF.
Its possible this format is missing from Access. I had this happen.

try RTF.
 
I've put in an "if" statement and forced the pdf format which now works ok

However the original data form opens in "filtered" mode
StDocName = "frmReportsInternal"
DoCmd.OpenForm StDocName, acNormal, "", "", , acNormal


how can I force to open all records
 
Remove the two lots of "" from your OpenForm criteria for a starting thought. Remove any filtering that is saved in the form design. See if that gets you unfiltered.
 
Of course, Silly me, it was in the Form design #Obvious
Thanks
 

Users who are viewing this thread

Back
Top Bottom