non-identical report copies

A

atlantis43

Hi; Wondering if anyone can solve this problem, which worked fine in Ac2 and
Ac2k, but does not seem to function properly in Ac2003.

I’m using the following elements to print different captions in [lblCopy] in
a report/ subreport of which I’m printing two copies.

Report ‘Declarations:
Dim Copies as integer

Report_on open;
Copies = 1

Report Detail section contains txtbox contol whose recordsource = [Page]&
[Pages]

lblCopy is a control in detail section of report

PageHeader_OnPrint event;
Select Case
Case 1
[lblCopy].caption = Original
Case 2
[lblCopy].Caption = Copy
End Select
If Page = Pages Then Copies = Copies + 1

Function PrintReport()
DoCmd.OpenReport “Report Nameâ€, acPreview
DoCmd.Printout , , , , 2,-1
End Function

The report consists of report data and a datasheet subreport, all present in
the Detail Section of the report. There is a Pageheader, which contains only
the abovementioned field, and there are no controls present in the PageFooter.


Anyone have any idea why this code works fine in Ac2, but not in Ac2003?
Any suggestions for correction are needed.
Richard
 
A

Allen Browne

If you initialize the variable in Report_Open, it will increment with each
time you go through the report. So if you open it in preview, and then
print, it will have the wrong value.

Here's a solution that requires no code, and can't go wrong.

A simple workaround it to create a table containing the names you want on
your report. A table with just 2 fields:
PrintTextID Number
PrintText Text
Enter 2 records:
1 Original
2 Copy

Create a query for the report, and add this table as well as your original
table. (If you already have a query, just add the new one to it.) It is
important that there is no line joining the 2 tables in query design view.
Save the query.

Now open the report in design view.
Make sure its RecordSource is the query you just saved.
In the Sorting'n'Grouping box (View menu), insert a row at the top
Put the PrintTextID field in that row of the dialog.
In the lower pane, choose Yes beside Group Header.
In the new group header, add a text box for PrintText.

The query now feeds 2 copies of the record to the report, and the header now
prints Original or Copy on the 2 copies.

If you do want to print just the original or just the copies, you can add
criteria to the query, or use the WhereCondition of OpenReport.
 
A

atlantis43 via AccessMonster.com

Allen; thanks for response. I've noted similar 'solution' descriptions for
this problem in monster, but I'm not sure that they are not more complicated
than simple for my problem. Though I might try & see, I'm hesitant because:
1)my reports (invoices) are obligatorily in many different formats (for
medical insurance billing), and the recordsources are variable-order
subqueries constructed on the fly. Adding another level of decision
construction seem like it might further complicate the logic.
2)While some forms REQUIRE several non-identical copies (2 or 3), others only
need them in certain circumstances, further confusing the programmer.

">If you initialize the variable in Report_Open, it will increment with each
time you go through the report. So if you open it in preview, and then
print, it will have the wrong value."

Is there any way to compensate for this in code, so that I don't have to
change the logical construction of what worked so well in Ac2?
Thanks, richard



Allen said:
If you initialize the variable in Report_Open, it will increment with each
time you go through the report. So if you open it in preview, and then
print, it will have the wrong value.

Here's a solution that requires no code, and can't go wrong.

A simple workaround it to create a table containing the names you want on
your report. A table with just 2 fields:
PrintTextID Number
PrintText Text
Enter 2 records:
1 Original
2 Copy

Create a query for the report, and add this table as well as your original
table. (If you already have a query, just add the new one to it.) It is
important that there is no line joining the 2 tables in query design view.
Save the query.

Now open the report in design view.
Make sure its RecordSource is the query you just saved.
In the Sorting'n'Grouping box (View menu), insert a row at the top
Put the PrintTextID field in that row of the dialog.
In the lower pane, choose Yes beside Group Header.
In the new group header, add a text box for PrintText.

The query now feeds 2 copies of the record to the report, and the header now
prints Original or Copy on the 2 copies.

If you do want to print just the original or just the copies, you can add
criteria to the query, or use the WhereCondition of OpenReport.
Hi; Wondering if anyone can solve this problem, which worked fine in Ac2
and
[quoted text clipped - 39 lines]
Any suggestions for correction are needed.
Richard
 
T

tina

you might try moving the label control, (and the page numbers control) to
the Page Footer section of the report, then run your code in the
PageFooterSection_Format event procedure.

hth


atlantis43 via AccessMonster.com said:
Allen; thanks for response. I've noted similar 'solution' descriptions for
this problem in monster, but I'm not sure that they are not more complicated
than simple for my problem. Though I might try & see, I'm hesitant because:
1)my reports (invoices) are obligatorily in many different formats (for
medical insurance billing), and the recordsources are variable-order
subqueries constructed on the fly. Adding another level of decision
construction seem like it might further complicate the logic.
2)While some forms REQUIRE several non-identical copies (2 or 3), others only
need them in certain circumstances, further confusing the programmer.

">If you initialize the variable in Report_Open, it will increment with each
time you go through the report. So if you open it in preview, and then
print, it will have the wrong value."

Is there any way to compensate for this in code, so that I don't have to
change the logical construction of what worked so well in Ac2?
Thanks, richard



Allen said:
If you initialize the variable in Report_Open, it will increment with each
time you go through the report. So if you open it in preview, and then
print, it will have the wrong value.

Here's a solution that requires no code, and can't go wrong.

A simple workaround it to create a table containing the names you want on
your report. A table with just 2 fields:
PrintTextID Number
PrintText Text
Enter 2 records:
1 Original
2 Copy

Create a query for the report, and add this table as well as your original
table. (If you already have a query, just add the new one to it.) It is
important that there is no line joining the 2 tables in query design view.
Save the query.

Now open the report in design view.
Make sure its RecordSource is the query you just saved.
In the Sorting'n'Grouping box (View menu), insert a row at the top
Put the PrintTextID field in that row of the dialog.
In the lower pane, choose Yes beside Group Header.
In the new group header, add a text box for PrintText.

The query now feeds 2 copies of the record to the report, and the header now
prints Original or Copy on the 2 copies.

If you do want to print just the original or just the copies, you can add
criteria to the query, or use the WhereCondition of OpenReport.
Hi; Wondering if anyone can solve this problem, which worked fine in Ac2
and
[quoted text clipped - 39 lines]
Any suggestions for correction are needed.
Richard
 
A

atlantis43 via AccessMonster.com

unfortuneately, the layout of the form doesn't allow any room BELOW the
detail section, so I'm unable to use that section even if the coding would
work (but for curiosity's sake I might just try it.
Richard
you might try moving the label control, (and the page numbers control) to
the Page Footer section of the report, then run your code in the
PageFooterSection_Format event procedure.

hth
Allen; thanks for response. I've noted similar 'solution' descriptions for
this problem in monster, but I'm not sure that they are not more complicated
[quoted text clipped - 51 lines]
 
G

Guest

What is the behaviour you see?

The code that you provided is obviously incorrect, what is the code
that you use?

(david)


atlantis43 via AccessMonster.com said:
Allen; thanks for response. I've noted similar 'solution' descriptions for
this problem in monster, but I'm not sure that they are not more complicated
than simple for my problem. Though I might try & see, I'm hesitant because:
1)my reports (invoices) are obligatorily in many different formats (for
medical insurance billing), and the recordsources are variable-order
subqueries constructed on the fly. Adding another level of decision
construction seem like it might further complicate the logic.
2)While some forms REQUIRE several non-identical copies (2 or 3), others only
need them in certain circumstances, further confusing the programmer.

">If you initialize the variable in Report_Open, it will increment with each
time you go through the report. So if you open it in preview, and then
print, it will have the wrong value."

Is there any way to compensate for this in code, so that I don't have to
change the logical construction of what worked so well in Ac2?
Thanks, richard



Allen said:
If you initialize the variable in Report_Open, it will increment with each
time you go through the report. So if you open it in preview, and then
print, it will have the wrong value.

Here's a solution that requires no code, and can't go wrong.

A simple workaround it to create a table containing the names you want on
your report. A table with just 2 fields:
PrintTextID Number
PrintText Text
Enter 2 records:
1 Original
2 Copy

Create a query for the report, and add this table as well as your original
table. (If you already have a query, just add the new one to it.) It is
important that there is no line joining the 2 tables in query design view.
Save the query.

Now open the report in design view.
Make sure its RecordSource is the query you just saved.
In the Sorting'n'Grouping box (View menu), insert a row at the top
Put the PrintTextID field in that row of the dialog.
In the lower pane, choose Yes beside Group Header.
In the new group header, add a text box for PrintText.

The query now feeds 2 copies of the record to the report, and the header now
prints Original or Copy on the 2 copies.

If you do want to print just the original or just the copies, you can add
criteria to the query, or use the WhereCondition of OpenReport.
Hi; Wondering if anyone can solve this problem, which worked fine in Ac2
and
[quoted text clipped - 39 lines]
Any suggestions for correction are needed.
Richard
 
A

Allen Browne

If you are creating the RecordSource string (SQL statement) in Report_Open,
it is simply a matter of:
- adding the PrintText table to the FROM clause without a join for those
cases where you want both, and
- assigning the PrintText field as ControlSource of the (otherwise unbound)
textbox.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

atlantis43 via AccessMonster.com said:
Allen; thanks for response. I've noted similar 'solution' descriptions
for
this problem in monster, but I'm not sure that they are not more
complicated
than simple for my problem. Though I might try & see, I'm hesitant
because:
1)my reports (invoices) are obligatorily in many different formats (for
medical insurance billing), and the recordsources are variable-order
subqueries constructed on the fly. Adding another level of decision
construction seem like it might further complicate the logic.
2)While some forms REQUIRE several non-identical copies (2 or 3), others
only
need them in certain circumstances, further confusing the programmer.

">If you initialize the variable in Report_Open, it will increment with
each
time you go through the report. So if you open it in preview, and then
print, it will have the wrong value."

Is there any way to compensate for this in code, so that I don't have to
change the logical construction of what worked so well in Ac2?
Thanks, richard



Allen said:
If you initialize the variable in Report_Open, it will increment with each
time you go through the report. So if you open it in preview, and then
print, it will have the wrong value.

Here's a solution that requires no code, and can't go wrong.

A simple workaround it to create a table containing the names you want on
your report. A table with just 2 fields:
PrintTextID Number
PrintText Text
Enter 2 records:
1 Original
2 Copy

Create a query for the report, and add this table as well as your original
table. (If you already have a query, just add the new one to it.) It is
important that there is no line joining the 2 tables in query design view.
Save the query.

Now open the report in design view.
Make sure its RecordSource is the query you just saved.
In the Sorting'n'Grouping box (View menu), insert a row at the top
Put the PrintTextID field in that row of the dialog.
In the lower pane, choose Yes beside Group Header.
In the new group header, add a text box for PrintText.

The query now feeds 2 copies of the record to the report, and the header
now
prints Original or Copy on the 2 copies.

If you do want to print just the original or just the copies, you can add
criteria to the query, or use the WhereCondition of OpenReport.
Hi; Wondering if anyone can solve this problem, which worked fine in Ac2
and
[quoted text clipped - 39 lines]
Any suggestions for correction are needed.
Richard
 
A

atlantis43 via AccessMonster.com

Allen;
Tried the cartesian implementation, and it works just fine! My only problem
is that, with all of the different invoice forms that I have, all with
different stringSQL recordsources, I have hours of work involved in setting
up the necessary changes. I
Since my report only has room for a detail section, I found that I can move
my lblCopy (now TxtCopy) onto my detail section with no ill effects, and
shrink the countid group header field to height=0. Everything now fits.
Thanks again
Richard

Allen said:
If you initialize the variable in Report_Open, it will increment with each
time you go through the report. So if you open it in preview, and then
print, it will have the wrong value.

Here's a solution that requires no code, and can't go wrong.

A simple workaround it to create a table containing the names you want on
your report. A table with just 2 fields:
PrintTextID Number
PrintText Text
Enter 2 records:
1 Original
2 Copy

Create a query for the report, and add this table as well as your original
table. (If you already have a query, just add the new one to it.) It is
important that there is no line joining the 2 tables in query design view.
Save the query.

Now open the report in design view.
Make sure its RecordSource is the query you just saved.
In the Sorting'n'Grouping box (View menu), insert a row at the top
Put the PrintTextID field in that row of the dialog.
In the lower pane, choose Yes beside Group Header.
In the new group header, add a text box for PrintText.

The query now feeds 2 copies of the record to the report, and the header now
prints Original or Copy on the 2 copies.

If you do want to print just the original or just the copies, you can add
criteria to the query, or use the WhereCondition of OpenReport.
Hi; Wondering if anyone can solve this problem, which worked fine in Ac2
and
[quoted text clipped - 39 lines]
Any suggestions for correction are needed.
Richard
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top