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!

The most FAQ here ?! 1

Status
Not open for further replies.

christerhaard

Programmer
Oct 5, 2002
28
0
0
SE
Hi guys,

have a numeric field

have a report

Would like the report to print as many copies as the value of the numeric field.

to print i use vb code:

If MyString = "yes" Then
DocName = "xxx"
DoCmd.OpenReport DocName, acNormal, "xxx_filter"
End If

Have a nice easter. . .

thankful for this forum / Chris Haard
 
Create a table called Numbers with 1 field "Numbers" type integer, enter 1 row for each number:
1
2
3
4
5
6
etc, right up to as many as you are likely to want to do, may want to put validation on the entry to stop people entering 500 in the box for example.

Then add this table to the query that underlies the report, and set the criteria to:

"Numbers.Numbers<=Val (txtQuantity)"

plus any other criteria you want, where txtQuantity is the textbox with your number in.

John
 
No need for a numbers table - there is a "copies" option for the Openreport command:

if the numeric field is accessible on the form from where you print the report, then
Code:
DoCmd.OpenReport DocName, acNormal, Me!numField

Else:
Code:
Dim num as Integer
num=Dlookup("NumField","table")
DoCmd.OpenReport DocName, acNormal, num
´

;-)
Hope this helps,
Andy

[blue]The last voice we will hear before the world explodes will be that of an expert saying:
"This is technically impossible!" - Sir Peter Ustinov[/blue]
andreas.galambos@bowneglobal.de
HP:
 
Hi Chris,

You can print multiple copies with the PrintOut Method ..

[blue]
Code:
DoCmd.OpenReport DocName, [highlight]acPreview[/highlight], "xxx_filter"
DoCmd.PrintOut acPrintAll, , , , [red][i]NoOfCopies[/i][/red]
DoCmd.Close acReport, DocName
[/blue]

Andy,

I don't have a "copies" option on the OpenReport in my Access 2K. Is it new in a later version?


Enjoy,
Tony

--------------------------------------------------------------------------------------------
We want to help you; help us to do it by reading this: Before you ask a question.
 
Andy

Which version of Access are you using? My 97 doesn't have that option, running wrong OS to check XP at the moment (the perils of dual boot PC's).

John
 
You're right Tony - was in the PrintOut command. [blush]
Tony's post should work fine.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top