printing invoice in Quick Report

I'm new in delphi4. I made an invoice module and I would like to print it.
The invoice consiste of two tables. MasterXYTable and DetailsXYTable. I'm trying to print it in quick report but with no succeed.
In the quick report I have defined again the Two tables giving them the same name MasterXYTable and DetailsXYTable. I put the Master table in Title Band and the detailsTable in the details Band and I made a Summary Band. In the summary band I put expressions to sum From MasterTable and from DetailsTable. In quick report main form I defined  the DataSet to MasterXYTable.
My Problems as follows:
- In the quickreport when I'm previewing the Invoice in the masterTable always shows the first record and in detailsTable if in one invoice there are more than one record, it shows only the first record and it shows also the first record from diffrent invoice numbers.
In the Summary band I'm getting resulsts only from MasterTable and nothing from detailsTable. In the exression wizard in the database field I cant insert database in expression I'm getting error message List Index out of bouds(0).
Thank you in advance for your help.
sivatagihercegAsked:
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.

Phoenix_sCommented:
10 points??

when you print a quick report, use whatever tactics you want... but in my experience with D4 and quickreports... use queries, not ttables

so you'd have query-master, and query-detail

then in quickrep, have a title, column header, detail, and even a summary

stick a public variable in the form declaration to hold the invoicenumber of the invoice you want to print out

the quickrep component should have it's dataset property set to the query-detail

then in the title or even the column header, you stick all the relevant header info as dbtext components... then the dbtext compionents in the header should have their dataset property set to the query-master, and the datafield properties set to the appropriate fields.

in the detail band... include only the query-detail fields you want to see

BEFORE printing this thing out..

open the report dynamically, place the invoicenumber in its placeholder, then call a loadquery procedure on the form before preview/printing it

if you want to send the report unit you have made I can perhaps send you a much better dissertation on how to get it to behave properly


0

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
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
Delphi

From novice to tech pro — start learning today.