K
Klaus Martini
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
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