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 problem (Number of copies from a field in a query) 1

Status
Not open for further replies.

frontside

Technical User
Sep 26, 2002
85
0
0
SE
The user chooses a Order.no in a form to get all the rows concerning that order, the result (of the query) would be something like this.

Order.No Order.Row Copies InfoText
4049 10 2 Text for row1
4049 20 1 Text for row2
4049 30 3 Text for row3


How do I make a printout of row 10 with 2 copies, then one printout of row 20 and 3 with the information of row 30.

I have searched the forum for a solution but cant find any, I would be happy for any help

Micke "Sweden"
 
Create a table "tblNums" with a single numeric field "Num" and add records with values 1 through the max "Copies" value. Add this table to your report's record source and don't join it to any other table. Add the Num field to your query grid and set the criteria under the Num field to:

<=[Copies]

This should create a Cartesian type query with one record for each "copy".

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]
 

I am going to try your solution later, this is what I´ve been working on, the only problem is that I get a printout of the form instead of the report (I do get the right amount of copies though :)

since I´m new to the whole idea of looping through a recordset I guess that the code isnt that good, would love any ideas of how to make the code work.

Dim conn As Connection
Dim rs As New ADODB.Recordset
Set conn = CurrentProject.Connection
rs.Open "PUPROKRO where D3402_Ordernr = ' 4049'", conn
Do Until rs.EOF
Dim ex As String
ex = rs!D18341_Antal_Etikett 'No of Copies
Dim stDocName As String
stDocName = "utskrift"
DoCmd.OpenReport stDocName, , , rs!D3403_Radnr, acViewPreview
DoCmd.PrintOut , , , , ex, 1
DoCmd.Close , stDocName
MsgBox rs!D3402_Ordernr & rs!D18342_Kommisionstex
rs.MoveNext
Loop
rs.Close
conn.Close

my idea with the code was to open the report and then print it with as many copies that the current record has in the no of copies field. then close the report and move on to the next record.
 
dhookom
I tried your solution and it worked great thanks a thousand times!!!

Its always fun when the solution is simple yet perfect




I´m still interrested about my little loop code, It would be great to get it to work as well. (just to learn)

Regards
Micke "Sweden"
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top