By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,984 Members | 1,461 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,984 IT Pros & Developers. It's quick & easy.

Limit what is printed on a report

lee123
100+
P: 556
can anybody explain how to use this syntax so i can print a report based on customers id and not all the reports

object.printreport (showdialog,range,pagefrom,pageto)

thanks,
lee123
Jan 16 '08 #1
Share this Question
Share on Google+
9 Replies


Expert 5K+
P: 8,434
Can you give us some idea of what version of VB you're using? What type of object object is? Where the data is coming from, that you want to filter?
Jan 17 '08 #2

debasisdas
Expert 5K+
P: 8,127
I guess you are using vb6.
Generate the report by filtering the records as per customer id and then use printreport method of the DataReport to print the report.
Jan 17 '08 #3

lee123
100+
P: 556
Hey killer42,

im using vb6, and i guess the object is the Datareport it's just the syntax i don't understand the range part is this for how you want to filter your report to what you want to report to show and what is the dialog part of this function. is there a web site that explains this because i search and they didn't have what i was looking for.

lee123
Jan 17 '08 #4

debasisdas
Expert 5K+
P: 8,127
just use

report1.printreport (showdialog,range,pagefrom,pageto)

showdialog- if print dialog is displaued or not
range --default is all
if specify range mention pagefrom (starting page of range) and pageto(last page of range ) to print
Jan 17 '08 #5

Expert 5K+
P: 8,434
lee123, if you look in the documentation, you'll see that the range argument on the PrintReport method simply allows you to specify whether you want to print all pages, or only those specified by the subsequent arguments. These relate only to the page number, not the contents. The ShowDialog argument won't help you, either. Based on what the doco says, it just shows the standard print dialogue box to allow the user to select which pages to print (and choose the printer, I suppose).

So the answer to your original question, about how to use PrintReport to limit which records are printed, is that you can't.

I believe that, as debasisdas said, you need to do the filtering before you hit the PrintReport method.
Jan 17 '08 #6

lee123
100+
P: 556
Yea Thanks,

I thought you couldn't but thanks for the help anyway.

Question,

When i put the code in for the Page from - Page To it will stay like that.
what i mean is if the report has three pages it will only print those three pages all the time? and when i scroll through the page reports it will print the report im on with the three pages.

example:

let say i wanted to print pages 5,6,7 i scroll to 5,6,7 then press print it will print these reports or will it start from the begining.

Thanks,
lee123
Jan 18 '08 #7

Expert 5K+
P: 8,434
Well as far as I know, you need to plug in the numbers for the pages you want. That's what the from and to parameters are for. The range parameter says whether to print all, or the ones specified in those other two. So from the sound of it, you would need to determine which pages you want, and feed those numbers into the PrintReport method.
Jan 18 '08 #8

debasisdas
Expert 5K+
P: 8,127
......................................
let say i wanted to print pages 5,6,7 i scroll to 5,6,7 then press print it will print these reports or will it start from the begining.
that part is handled by showdialog.
i fyou want to print page 5,6, 7and then from 10 upto15 ,you can specify that in the print dialogbox
specify like

5,6,7,10-15
Jan 18 '08 #9

lee123
100+
P: 556
Thanks for the help. you two

lee123
Jan 18 '08 #10

Post your reply

Sign in to post your reply or Sign up for a free account.