flipping suntax !!!!

Lanason

Registered User.
Local time
Today, 22:39
Joined
Sep 12, 2003
Messages
258
:banghead:
I am creating and saving a pdf version of a report and then opening for viewing

In the viewing I can use the "ID" no to link it, but in the Docmd.OuptutTo I can't see where in the syntax I can put the equivalent of "[ID]=" & [ID],

can anyone help??

Code:
ReportName = "ABC123"
DoCmd.OutputTo acOutputReport, ReportName, acFormatPDF, "P:\Fault Analysis Reports\" & Forms!frmComplaintsDetail![Customer] & "\" & [FARNo] & " - " & Forms!frmComplaintsDetail![ShortDesc] & "\" & [FARNo] & " v" & [DocumentVersion] & ".pdf", False, "", 0
    
DoCmd.OpenReport ReportName, acViewPreview, "", "[ID]=" & [ID], acNormal
 
the QUERY uses the ID.
in: docmd.OutputTo acOutputReport ,"rptMyReport",acFormatPDF,"c:\folder\file.pdf"

rptMyReport uses the query: qsMyQuery
the query looks at a field on the form:
select * from table where [id]=forms!myForm!txtID
 
am I right in thinking that:-

the query selection has to be in the reports underlying query and cannot be in the VBA code ...
 
If you open the report in preview and export the report while the preview is open the filtered report is exported.
 
Ah ok I understand let me try it . . .
 
yes it worked
Code:
        ReportName = "rptReport"
        DoCmd.OpenReport ReportName, acViewPreview, "", "[ID]=" & [ID], acNormal
        DoCmd.SendObject acReport, ReportName, acFormatPDF, MailTo, MailCC, MailBcc, Subject, MailGreeting & MailMessage & MailSignature, True

however it has the generic form name. Can I specifically name the pdf with the ID no?

or as I have already saved the pdf to a folder is it possible to attach the saved version which has the correct name
 
you can set the ID by incorporating it into the filename.
but for email, it prob uses the report.caption
you could alter the rpt.caption using vb before you send it.
 

Users who are viewing this thread

Back
Top Bottom