Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

printout copies based on a number field in report query 1

Status
Not open for further replies.

tballky

Programmer
Jun 10, 1999
11
0
0
US
i need to use a number of copies provided by a field in the query used for the report. I believe that "printout" found either in macro or vba docmd can do this but do not know how to reference the field. In the printout macro i have tried variations in the copies =val([tag]) and =val([txttag]) where tag is the field and txttag is a txtbox with tag as its control on the report being printed. i see the needed number in the txttag when printed but can not get the copies to use it and one copy is printed. i have last tried:
DoCmd.OpenReport "R_Part_Tags-4000", acViewPreview
DoCmd.PrintOut , , , , "val(format([Tags]))"

the following solution to fix the copies almost has it:
hymn (TechnicalUser) 3 Nov 04 11:04
Tried and tested on A2002
DoCmd.OpenReport "Birthdays", acViewPreview
DoCmd.PrintOut , , , , 2


I thought i tried to try that...
 
You might be able to use a table of numbers
Table: tblNums
Field: Num integer

Add values 1 through you max copy value

Add this table to your report's record source and set the criteria under the Num field to:
<=[Tag]
This will create Tag number of copies of each record.

Duane MS Access MVP
[green]Ask a great question, get a great answer.[/green] [red]Ask a vague question, get a vague answer.[/red]
[green]Find out how to get great answers faq219-2884.[/green]
 
Thanks, Duane, I didn't express my challenge clearly enough. I have the number of copies calculated and shown by the [tags] field. My problem is being able to use that field as the number of copies in the syntax of the printout statement. Seems any attempt to use the field instead of an actual number gets an error. If I use the val statement i do not get an error but the count is not being used.

I thought i tried to try that...
 
My proposed solution allows you to create a single printout with multiple copies. This might or might not work for you. The recordsource would be a "cartesian" query.

Your main sorting and groupoing level would be the Num field. You would use the Num header as the Report Header.

Duane MS Access MVP
[green]Ask a great question, get a great answer.[/green] [red]Ask a vague question, get a vague answer.[/red]
[green]Find out how to get great answers faq219-2884.[/green]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top