Pivot Tables: Please HElp!

G

Guest

I have a print function on a form and the sub form is a pivot table, I an
trying to only print information that I have filtered in the pivot table, but
its printing all the information in the pivot table. Please help

The following is my print function.

Private Sub Command3_Click()
On Error GoTo Err_Command3_Click

Dim stDocName As String
Dim MyForm As Form

stDocName = "Employee Infor pivot table"
Set MyForm = Screen.ActiveForm
DoCmd.SelectObject acForm, stDocName, True
DoCmd.PrintOut
DoCmd.SelectObject acForm, MyForm.Name, False

Exit_Command3_Click:
Exit Sub

Err_Command3_Click:
MsgBox Err.Description
Resume Exit_Command3_Click

End Sub
 
G

George Nicholson

DoCmd.SelectObject acForm, "Employee Infor pivot table", True
DoCmd.PrintOut
Is telling Access to open a new, unfiltered, instance of that form and print
that. Unfortunately, I don't think you can change True to False and get the
results you want either since Access does not consider subforms to be
members of the "Forms that are already open" collection. You can try it,
but I'm sure you'll get an error.

I don't know of any way to send the filtered subform to the printer.

However, you *can* send the Parent form:
DoCmd.SelectObject acForm, MyForm.Name, False
DoCmd.PrintOut
You can set the "Display When" property of all other controls/sections on
the Parent to "Screen Only". Just make sure the control containing your
subform and the section containing that control is set to "Always". It may
be redundant, but set the "Can Shrink" properties of "Screen Only" sections,
etc. to Yes.

Not sure if that's the absolute best solution. Maybe someone will provide a
more elegant one.

You might also want to take a quick look at:
ACC2002: Subform in PivotChart or PivotTable View Extends Past Right Margin
of the Page
http://support.microsoft.com/default.aspx?scid=kb;en-us;287492

HTH & Good Luck,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top