Hi,
I am trying to build an invoicing system in Access 2003. Eventually, I would like to retrieve data from a server, populate tables, preview and print invoices. I have managed to do everything except the preview part.
An invoice has the following properties:
- all pages have the same header (company logo and contact details + customer name and address)
- the first page contains a stub that the customer will cut and send back to us with a check
- the first page can contain 12 records maximum (because of the stub)
- the following pages can contain 24 records each
Users will have access to a form to select the invoices they want to print preview and/or print.
What I have done so far is create a report that contains all the objects I need (logo, stub, 24 textboxes). I have put everything in the detail section. Then, in the code, I fill in the pages and hide objects I do not need depending on the page I am on. Once a page is full, I programatically print it (using DoCmd.OpenReport).
The problem if I do that is that when I hit print preview I only see the last page of the invoice as I am constantly deleting and rewriting on the same page.
So I have changed my report and I am now using a subreport to display only the records. This subreport is based on a query that retrieves all the records for this invoice and is contained in the detail section of the report. The idea here is to change the height of the subreport if I am on another page than the first one. The thing is, I do not see how I can count pages.
I thought I could create a query that returns only 12 records (using the SQL keyword TOP) and another query for the other pages and link each one of them to a subreport. But it still does not solve my problem which is that I want to be able to see all the pages of one invoice in the print preview window.
Does someone have an idea on how to do that?
Thank you very much for your help.
I am trying to build an invoicing system in Access 2003. Eventually, I would like to retrieve data from a server, populate tables, preview and print invoices. I have managed to do everything except the preview part.
An invoice has the following properties:
- all pages have the same header (company logo and contact details + customer name and address)
- the first page contains a stub that the customer will cut and send back to us with a check
- the first page can contain 12 records maximum (because of the stub)
- the following pages can contain 24 records each
Users will have access to a form to select the invoices they want to print preview and/or print.
What I have done so far is create a report that contains all the objects I need (logo, stub, 24 textboxes). I have put everything in the detail section. Then, in the code, I fill in the pages and hide objects I do not need depending on the page I am on. Once a page is full, I programatically print it (using DoCmd.OpenReport).
The problem if I do that is that when I hit print preview I only see the last page of the invoice as I am constantly deleting and rewriting on the same page.
So I have changed my report and I am now using a subreport to display only the records. This subreport is based on a query that retrieves all the records for this invoice and is contained in the detail section of the report. The idea here is to change the height of the subreport if I am on another page than the first one. The thing is, I do not see how I can count pages.
I thought I could create a query that returns only 12 records (using the SQL keyword TOP) and another query for the other pages and link each one of them to a subreport. But it still does not solve my problem which is that I want to be able to see all the pages of one invoice in the print preview window.
Does someone have an idea on how to do that?
Thank you very much for your help.