Link to home
Start Free TrialLog in
Avatar of DoveTails
DoveTailsFlag for United States of America

asked on

MS Access 2007 Open Pivot Table without previous criteria

I created a pivot table and saved it as a form.
The form is opened with a command button with one line of code:

DoCmd.OpenForm "frmTheForm", acFormPivotTable, , , acFormReadOnly, acWindowNormal

Works well for the users ... with one problem.

Each supervisor opens the pivot table and specifies the criteria they are interested in by using the drop down menus of the pivot table.  This usually involves looking at employees in their department or filtering to see only a certain job title.  When the pivot table is closed ... the next person who opens the pivot table sees the previous person's criteria and not all of the data.

I would like the pivot table to open without any specific criteria and simply display off of the availble data.

Any help on how to open the pivot table so all of the data is diplayed would be appreciated.
Thanks
Avatar of als315
als315
Flag of Russian Federation image

You can disallow saving changes when pivot is closing:
docmd.close acForm,"MyPivotForm",acSaveNo
An addition:
you should disable any form closing buttons and add event to On Key Press for the form:
Me.Undo
docmd.close acForm,"frmTheForm",acSaveNo

Form will be closed without save on any pressed key
(AFAICT) This is the nature of a Pivot Table in MS Access

There may be a way around this that I am not aware of though...
Avatar of DoveTails

ASKER

Thanks for the comments ... I have not had any luck with the pivot table yet.
Me.undo prevents user from making any preferences while using the table and the code with acSaveNo does not error but it does not prevent the user's preferences from being saved (or stored) in Access.  I'm beginning to think boaq2000 is correct in that this is the nature of MS Access.
Have you do it with On Key Press event?
ASKER CERTIFIED SOLUTION
Avatar of Jeffrey Coachman
Jeffrey Coachman
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks for the help with the pivot tables.

The idea for a copy as a 'backup' is most likely what I'll do but I have to test that with multiple users hitting the table at the same time.  

note: When using the on press event with 'undo': this prevented the user from making any preference changes...I need them to be able to that while they are viewing...just don't want those to be saved.

So thanks again.