If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Professional layout for a dictionary
Hi,
I use Access 2007 to store the data of a dictionary. Now, when it comes to print it out, I wonder if the following task can be done from within Access: First, I want to explain the structure of my dictionary: The entries in it, which contain the detailed data, are grouped into chapters. Each chapter begins with a short descriptor (Aa1, Aa2, Aa3, Ab1, ..., Cd12), followed by a describing name e.g.: Aa1 buildings entry 1 specs for entry 1 entry 2 specs for entry 2 entry 3 specs for entry 3 ... Aa2 countries entry 4 specs for entry 4 entry 5 specs for entry 5 entry 6 specs for entry 5 ... The length of the chapters, i.e. how many entries there are per chapter can vary. One chapter can hold only one entry or tens of entries, thus the range of a chapter can be from 1 part of a page to several pages. Now, the task to accomplish is, to generate individual page headers, containing the chapter descriptors and depending on the chapter displayed on a certain page or a range of pages. E.g., if Aa1 buildings ranges from page 1 to 8, and chapter 2 begins on top of page 9, in the header of pages 1-8 should be written (aligned to the right): Aa1. If, however, chapter 2 already starts on page 8, the header Aa1 should only appear on pages 1-7, on page 8 the header should be Aa2, because this is the page chapter 2 begins. If 1 short chapter Cc1 Cars clompetely fits on a page an chapter Cc2 Compters starts on the same page, in the header of this page should be Cc1, Cc2. The descriptors are unique strings which won't occur elsewhere in the text except as the first part of a chapter. My approach would be, that this task is some sort of post-processing of the report. In pseudo-code the task would probably look like this Generate pages of report For each page of generated report HEADER = "" repeat Parse page If descriptor_found then HEADER = HEADER & descriptor until END_OF_PAGE Write HEADER at specified position on top of this page Next But how would it look like in real VBA-code? If it can be done at all. Best regards Klaus |
#2
|
|||
|
|||
Professional layout for a dictionary
Klaus Martini schrieb:
Hi, I use Access 2007 to store the data of a dictionary. Now, when it comes to print it out, I wonder if the following task can be done from within Access: First, I want to explain the structure of my dictionary: The entries in it, which contain the detailed data, are grouped into chapters. Each chapter begins with a short descriptor (Aa1, Aa2, Aa3, Ab1, ..., Cd12), followed by a describing name e.g.: Aa1 buildings entry 1 specs for entry 1 entry 2 specs for entry 2 entry 3 specs for entry 3 ... Aa2 countries entry 4 specs for entry 4 entry 5 specs for entry 5 entry 6 specs for entry 5 ... The length of the chapters, i.e. how many entries there are per chapter can vary. One chapter can hold only one entry or tens of entries, thus the range of a chapter can be from 1 part of a page to several pages. Now, the task to accomplish is, to generate individual page headers, containing the chapter descriptors and depending on the chapter displayed on a certain page or a range of pages. E.g., if Aa1 buildings ranges from page 1 to 8, and chapter 2 begins on top of page 9, in the header of pages 1-8 should be written (aligned to the right): Aa1. If, however, chapter 2 already starts on page 8, the header Aa1 should only appear on pages 1-7, on page 8 the header should be Aa2, because this is the page chapter 2 begins. If 1 short chapter Cc1 Cars clompetely fits on a page an chapter Cc2 Compters starts on the same page, in the header of this page should be Cc1, Cc2. The descriptors are unique strings which won't occur elsewhere in the text except as the first part of a chapter. My approach would be, that this task is some sort of post-processing of the report. In pseudo-code the task would probably look like this Generate pages of report For each page of generated report HEADER = "" repeat Parse page If descriptor_found then HEADER = HEADER & descriptor until END_OF_PAGE Write HEADER at specified position on top of this page Next But how would it look like in real VBA-code? If it can be done at all. This task is quite challenging and I don't think it can be done with Access alone. The problem is that I can't imagine a way to parse a formatted report. But WORD can parse a document, so consider the following approach: 1. Generate the report 2. Export the report to WORD (rtf) 3. Write a macro in WORD which parses the report and writes out a table which contains two rows, Descriptor and Page, Page being the number of the page where the descriptor appears: Descriptor Page Aa1 1 Aa2 8 Aa3 10 ... ... 4. Import this table into Access and do the printing in the reports print event on the basis of the data in this table. All you need is there. I don't know if the process can be fully automated. If you try it and it works, let me know. Regards, P. W. -- Latinitatem colamus! |
#3
|
|||
|
|||
Professional layout for a dictionary
Peter Wetschnigg schrieb:
Klaus Martini schrieb: Hi, I use Access 2007 to store the data of a dictionary. Now, when it comes to print it out, I wonder if the following task can be done from within Access: First, I want to explain the structure of my dictionary: The entries in it, which contain the detailed data, are grouped into chapters. Each chapter begins with a short descriptor (Aa1, Aa2, Aa3, Ab1, ..., Cd12), followed by a describing name e.g.: Aa1 buildings entry 1 specs for entry 1 entry 2 specs for entry 2 entry 3 specs for entry 3 ... Aa2 countries entry 4 specs for entry 4 entry 5 specs for entry 5 entry 6 specs for entry 5 ... The length of the chapters, i.e. how many entries there are per chapter can vary. One chapter can hold only one entry or tens of entries, thus the range of a chapter can be from 1 part of a page to several pages. Now, the task to accomplish is, to generate individual page headers, containing the chapter descriptors and depending on the chapter displayed on a certain page or a range of pages. E.g., if Aa1 buildings ranges from page 1 to 8, and chapter 2 begins on top of page 9, in the header of pages 1-8 should be written (aligned to the right): Aa1. If, however, chapter 2 already starts on page 8, the header Aa1 should only appear on pages 1-7, on page 8 the header should be Aa2, because this is the page chapter 2 begins. If 1 short chapter Cc1 Cars clompetely fits on a page an chapter Cc2 Compters starts on the same page, in the header of this page should be Cc1, Cc2. The descriptors are unique strings which won't occur elsewhere in the text except as the first part of a chapter. My approach would be, that this task is some sort of post-processing of the report. In pseudo-code the task would probably look like this Generate pages of report For each page of generated report HEADER = "" repeat Parse page If descriptor_found then HEADER = HEADER & descriptor until END_OF_PAGE Write HEADER at specified position on top of this page Next But how would it look like in real VBA-code? If it can be done at all. This task is quite challenging and I don't think it can be done with Access alone. The problem is that I can't imagine a way to parse a formatted report. But WORD can parse a document, so consider the following approach: 1. Generate the report 2. Export the report to WORD (rtf) 3. Write a macro in WORD which parses the report and writes out a table which contains two rows, Descriptor and Page, Page being the number of the page where the descriptor appears: Descriptor Page Aa1 1 Aa2 8 Aa3 10 ... ... 4. Import this table into Access and do the printing in the reports print event on the basis of the data in this table. All you need is there. I don't know if the process can be fully automated. If you try it and it works, let me know. Hi Peter, Thanks for your suggestions! It is a bit tedious, but it works! Except for one thing: There is no print event of the report, the printing of the header lines has to be done in the format-event of the pageheader. Best regards Klaus |
Thread Tools | |
Display Modes | |
|
|