Printing reports based on group id

  • Thread starter Thread starter DG
  • Start date Start date
D

DG

Ok this is driving me nuts: I have 9 records in the clients table, based on
the group code in the rs!RptG field the appropriate reports should print per
client. I can only get the first 3 records to print...ahhhhh.

I don't understand??.........And as always thanks for your help in advance.

Function GrpRpt()
Dim db As Database
Dim rs As Recordset
Set db = CurrentDb()
Set rs = db.OpenRecordset("tblclient")
Do While Not rs.EOF
If rs.EOF = False Then
Select Case rs!RptG
Case 1
DoCmd.OpenReport "rpt4", acViewPreview, , "AutoId =" & rs!AutoId
DoCmd.OpenReport "rpt3", acViewPreview, , "AutoId =" & rs!AutoId
Case 2
DoCmd.OpenReport "rpt2", acViewPreview, , "AutoId =" & rs!AutoId
Case 3
DoCmd.OpenReport "rpt1", acViewPreview, , "AutoId =" & rs!AutoId
Case 0
Debug.Print " Report Failed " & rs!AutoId & " " & rs!LastN;
End Select
End If
rs.MoveNext
Loop
End Function

Client Table
AutoId
LastN
FirstN
RptG

1
SMITH
JAMES
1

2
JOHNSON
JOHN
2

3
WILLIAMS
ROBERT
3

4
JONES
MICHAEL
3

5
BROWN
WILLIAM
2

6
DAVIS
DAVID
3

7
MILLER
RICHARD
2

8
WILSON
CHARLES
3

9
MOORE
JOSEPH
1
 
You can only easily have one instance of a report open at one time. You
could try remove acViewPreview so the reports go directly to the printer.
 
Duane, I only had print preview so that I could do my testing, to see what
was printing. Are you saying if I remove the print preview and send
directly to print, all 9 clients will print? The issue is I can't get all 9
to view, only the first 3. Unfortunately the table data I posted isn't
showing well to demonstrate what I was attempting.

For Pete's sake...you are sooooo right....do you know how long I've spent on
this!! That should be documented better or something..sheesh...

Thank you, Thank you, Thank you, Thank you, Thank you, Thank you
 
Back
Top