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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Trying to run report based on where condition to print separate PDFs

Status
Not open for further replies.

PenelopeC

Technical User
May 12, 2003
72
US
Hi.
Please (PLEASE) tell me what I'm doing wrong here...

<begin code>
Private Sub cmdPrtCallDetailPerAU_Click()
On Error GoTo Err_cmdPrtCellDetailPerAU_Click

Dim stDocName As String
Dim db As Database
Dim rs As Recordset
Dim i As Integer

Set db = CurrentDb
Set rs = db.OpenRecordset(&quot;SELECT au_list.au_list FROM au_list;&quot;)
rs.MoveLast
rs.MoveFirst
For i = 0 To rs.RecordCount - 1
DoCmd.CopyObject , &quot;CellDetail&quot; & rs!au_list, acReport, &quot;rptVerizonCallDetail&quot;
stDocName = &quot;CellDetail&quot; & rs!au_list
DoCmd.OpenReport stDocName, acNormal, , &quot;txtBureau = '&quot; & rs!au_list & &quot;'&quot;
DoCmd.DeleteObject acReport, stDocName
rs.MoveNext
Next i

Exit_cmdPrtCellDetailPerAU_Click:
Exit Sub

Err_cmdPrtCellDetailPerAU_Click:
MsgBox Err.Description
Resume Exit_cmdPrtCallDetailPerAU_Click

End Sub

<end code>

All I want is one pdf for each &quot;AU&quot; from the AU_LIST table. When I run this code, it calls EVERYTHING &quot;rptVerizonCallDetail&quot; and it does not read the correct AU from the &quot;txtBureau&quot; control (which is hidden) on the report. Is this because the control is hidden?

I'm in Access97 on a Win2K box. THANK YOU, THANK YOU for your help :)

PenelopeC
~~~>-/O~~~~~swimming right along
 
I've finally figured it out and thought I would post here in case anyone else has the problem.

I had an entry in the report's &quot;Caption&quot; property that the program defaulted to over and above the programming I had entered to step through the list of departments.

How's that for a &quot;DOH!&quot;?



PenelopeC
~~~>-/O~~~~~swimming right along
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top