Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Narrowing Results of DoCmd.OutputTo

Status
Not open for further replies.

nonturbo

IS-IT--Management
Aug 27, 2001
78
US
I have a button on a form that calls this code, which perfectly opens a report in print-preview mode...

DoCmd.OpenReport stDocName, acPreview, , "[CandidateID] = Forms![Candidates].form![CandidateID]"

..The problem is, I'd like to have a different button that will automatically export this same report to an RTF file and possibly even go a step further and email to a runtime-specified email address. I don't care much about the code for emailing at this moment, but if you'd like to help with that step, by all means feel free.. :) I'm using the following code to export to an RTF file (which it does), however it exports ALL records to a super-huge RTF file, because I'm not specifying a certain criteria in the code as I was with the DoCmd.OpenReport, anywho.. heres the code..

DoCmd.OutputTo acOutputReport, stDocName, acFormatRTF, stOutputFileName

How can I limit the creation of the RTF to ONLY match CandidateID as I am with the DoCmd.OpenReport function? Nothing I've tried works! Please help. Thanks!!!!
 
Hi!

Base the report on a query, if it isn't already, and put the criteria there.

hth
Jeff Bridgham
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top