Print reports using Module

  • Thread starter Thread starter sjones298
  • Start date Start date
S

sjones298

Guest
I want to print two reports using the Module. One original and one that has "copy" printed on it. I created a report that has "copy" and added it as a subreport to the original report and set visible = no. My code is working to print out the first report but how do I turn on the subreport "copy" and print the second report?
(I have multiple reports based on state logic so I need to use _Letter to print all my reports.)

DoCmd.OpenReport rule("State_abbr") & "_Letter", acNormal

Thanks for your help!!!
 
One way to do this is to create a table that consists of one field. Name the field "CopyName", set the Datatype as Text, set the "Allow Zero Length" property for this field to "Yes". Close and Save the new table and give it a name ... something like "tblCopies". Open this table, enter a space as the value in the field you named "CopyName", hit enter to go to the second record and type "Copy" (without the quotes). These are the only two records to be added to this table ..... Close the table.

Now open the Query that your Report is Bound to and add this new table into the recordset. Include the field (CopyName) into the Query. Do not place any relational joins to this table.

Now you can get the word "Copy" from the recordset (use a txtbox bound to the "CopyName" field) and it will only be on the second copy printed. The report will automatically generate two copies because table with the two records you added.

HTH
RDH

[This message has been edited by R. Hicks (edited 12-27-2001).]
 
Dear R. Hicks,

Thanks for your help.

I am not using a Query. The Report is Bound to a table called "tbl_letter_temp". Is there some code I can use in the module to accomplish this task? Thanks.

sj
 
Dear R. Hicks,

I followed your suggestion and it worked!!! Ignore my previous message. Thanks.

SJ
 
hey RDH,

that's pretty slick!

al
 
I can't take credit for coming up with it. I learned this trick a few years ago on a forum much like this .....

I can't remember who posted it, or where I saw it, but it works.

RDH
 

Users who are viewing this thread

Back
Top Bottom