Hi, I was wondering of there is a possibility to print a report or label a certaim number of times, based on a value that you would put in to that report or label.
Sami Shamma
@Reply 9 months ago
Yes, I do that all the time.
Using VBA, I will call the report from inside a loop from 1 to NumberOfCopies
Adam Schwanz
@Reply 9 months ago
Sure, there are a number of ways you could do it. I'll include one that I've used at a location that prints labels out on like Avery 5160 label paper. They use a form to select a part from, and enter a Qty. Might give you some ideas at least.
It uses 2 tables, the part/qty information goes into my SingleLabelT (from the form) and the code lists out the parts in SingleLabelRT that the report is based on. So if I put qty 3, then the code will add 3 records for that part (thus getting 3 labels on the report).
Dim X As Integer, MaxRec As Integer
Me.Refresh
Dim DB As Database
Dim RS As Recordset, rs2 As Recordset
Set DB = CurrentDb()
Set RS = DB.OpenRecordset("SingleLabelT")
Set rs2 = DB.OpenRecordset("SingleLabelRT")
While Not RS.EOF
MaxRec = RS!Qty
For X = 1 To MaxRec
rs2.AddNew
rs2!PartNum = DLookup("PartNum", "PartsT", "PartID=" & RS!PartNum)
rs2!Description = DLookup("Description", "PartsT", "PartID=" & RS!PartNum)
rs2!BinLocation = DLookup("BinLocation", "PartsT", "PartID=" & RS!PartNum)
rs2.Update
Next
RS.MoveNext
Wend
RS.Close
DB.Close
Set RS = Nothing
Set DB = Nothing
And yea, I may have misunderstood the question :P. If it's the full report then just loop through as Sami said and keep re-printing. I'll leave my other post here in case it's more similar to what you're trying to do.
Raymond Spornhauer
@Reply 9 months ago
You will probably need to use the 'Sleep' function in your loop to prevent the code from running so fast the printer doesn't see it.
-Raymond
Sorry, only students may add comments.
Click here for more
information on how you can set up an account.
If you are a Visitor, go ahead and post your reply as a
new comment, and we'll move it here for you
once it's approved. Be sure to use the same name and email address.
This thread is now CLOSED. If you wish to comment, start a NEW discussion in
Visitor Forum.