Quickreport label repeater

I made a delphi 3.o application.
I print records from a query to a quickreport on avery labels (20 labels a sheet).
This works fine.
But, now I want to build an option to print the records from the query more then one time.
Example: In my query I select 3 records. The user can set a counter to (by.exam) 5. Now I want to print 15 labels on one sheet !

I tryed this.

quickreport-'Afterprintdetailband' I set query1.first (or query1.prev). But this does not work.
When the last record is reached the quickreport close and doesn't see the query1.first anymore.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

RichardBorstAuthor Commented:
Edited text of question.
Do you print all the records in the same cycle on the detail band? or is the detail band reprinted for each of the 3 (now 15) records ??

If you print one record for each cycle, you might find the "OnNeedData" event of the report useful; here you set the "moredata" var param to true if you want the print cycle to continue.

The solution to your problem pretty much depends on exactly how you want the records to appear on the paper, so we'll need a closer specification of this.


You could print 5 copies like this LabelReport.PrinterSettings.Copies := 5;

Become a CompTIA Certified Healthcare IT Tech

This course will help prep you to earn the CompTIA Healthcare IT Technician certification showing that you have the knowledge and skills needed to succeed in installing, managing, and troubleshooting IT systems in medical and clinical settings.

I see two ways to do this:

(1) This could get messy, but I think it is possible --- you can dynamically change the detailband and its contents.  That is, have 20 copies of TQRExpr or TQRLabel or whatever you use ready, and just use one.  If the user selects, for instance 5, use the first 5 copies.  Don't forget to set the height of the detailband and locations of all 5 TQRLabels.  

(2) Have an empty database just for this purpose, whose structure is identical to the original.  After the query, fill in the database with as many duplicate records the user requests.  Then, use QR.  

In any case, as classmate said, it is better if we can see what kind of label you want to print out.  
RichardBorstAuthor Commented:
The database I want to print from is a store with articles. I want to print one article (code + subscripsion) to one label. Each Record (=article, =label) is printed by the detailband in my quickreport. I made 2 columns with 10 recors in each column.

when I said:
LabelReport.PrinterSettings.Copies := 5;
I gues I get 5 sheets. That's not what I want.

I tried This:

procedure TQRLabelsForm.QRLabelsFormNeedData(Sender: TObject;
  var MoreData: Boolean);

iF (timesprinted > 0) and datamodule2.query3.Eof then begin
                                                       moredata := true;
Where timesprinted is 5 in my example.
But the report stops after printeing the 3(in my example) records.
Is there a way to go to the first record when the report reached te last record ?
The QuickReport is a rather stubborn component. If you're sure that you reach eof and timesprinted>0, you might as well stop using data aware labels, and rather browse the table manually.

In the beforeprint of the band, you assign the appropriate strings from the query to regular labels. If you have added the query fields in the datamodule, simply use the desired field object's AsString method.

In AfterPrint of the band you call your query's next method;

In OnNeedData of the report you test on eof and decide wether you want to go call the "first" method.


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
meant to write "want to call the "first" method".....
RichardBorstAuthor Commented:
Sorry, I mean goods in a wharehouse instead of articles in a store.
RichardBorstAuthor Commented:
This helps me to comnplete my application succesfully.
I brows the query manually. In the wuickreport I make the dataset -property empty. But I will use the database fields in my labels. At alterdetailprint method I give query.next.
At Onneeddata I check on EOF and on timesprinted.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.