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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

I don't want to see the export options window!!!

Status
Not open for further replies.

deangelis

Programmer
May 13, 2003
54
ES
Hi,
I'm working with VB6 e CR8.5, and I use the rptControl.
When I click the print report button (that is a command button) I want that the report is printed without another window (Export Options) where, in theory, I can choose if i want one page or al pages.
How Can?
Bye
N@pol€on
 
What code do you have behind the command button?

What exactly do you mean by rptControl? Does this refer to the OCX control?

If you are using the OCX, you could simply set the destination to printer rather than screen and have the .Action = 1 process the report straight to the printer.

Of you are using the RDC, you can call the PrintOut False method to print without prompting.

By what you have noted, it sounds like your print button actually exports the report.

Perhaps if you explain exactly what you are desiring with a code snip we could offer something up.

Cheers,

SurfingGecko
Home of Crystal Ease
 
Sorry,
For rptControl I mean the OCX Control. The destination is a file .rtf.
This is the code in the command button "print report":
With rptControl
.DiscardSavedData = True
.PrintFileName = myDirectory & "\" & SelItem & "_DETAILS.rtf"
.ReportFileName = App.Path & "\Report\Essay-Scenario-Detail.rpt"
.DataFiles(0) = MyDB.Name
.ReplaceSelectionFormula ("{ESSAY.essay_id}='" & SelItem & "' ")
'seleziona il subreport
For j = 0 To .GetNSubreports - 1
.SubreportToChange = .GetNthSubreportName(j)
.DataFiles(0) = MyDB.Name
.ReplaceSelectionFormula ("{ESSAY_SCENARIO.essay_id}='" & SelItem & "' ")
.SubreportToChange = ""
Next
'fine selezione subreport
.PrintReport
End With

Maybe instead of ".printreport" I have to write .action=1?
Thanks
N@pol€on
 
PrintReport and Action = 1 do the same thing, only Action = 1 is newer and contains some additional error handling. I would switch this anyway

You are not setting the .Destination to DiskFile in your code sequence. I would add that line as well jsut ot make sure the request is being sent.

And you are not setting the Export Options for this report. You should be setting the format (so the proper dll can be loaded) and its related properties (like page range)

Remember that with the OCX the only line that actually gets execured is the Action = 1 or PrintReport method. So if there is an error in any line above it, the code will not break.

I think you are almost there with this. Best ide is to make sure Option Explicit is in the General Declarations of the module so you can actually browse the intellisense list of properties for your rptControl. This is best way to see what is available to you.




Cheers,

SurfingGecko
Home of Crystal Ease
 
Thanks,
but there is the last question:
How Can i set the page range?
Bye
N@pol€on
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top