I am using Access 2010, SP2. Both I and all users are using Windows XP. (yeah, I know...)
I've got an unbound form that has a subform bound to a query. The subform is a continuous form with a dozen or so columns. There are some filter selections (comboBoxes) on the Main form that filters the data in the subform. I do this by changing the QueryDef for the query based on the combobox items the user selects, and requery the subform whenever the user changes one of the comboBoxes. So far, everything works great. When I print the report, it comes out the same as the form.
(More info in case it's relevant: The query is now actually a Stored Procedure on a SQL Server, but the process is still the same.)
I want to use Print Preview instead of Print so that the user can see the report first, adjust margins, scaling, etc. based on the printer where the report is going to print. This also gives them the option to print it to a PDF. All of this is built in to the Access Print Preview ribbon.
So, here's the problem: Unlike the print function, Print preview does a requery on the subform before it pulls up the preview. This is only annoying in most cases, as most users using this project are remote to the server, and the requery means it is slower than the print function. But, in additon to the filters (comboboxes) I have provided, users can use the built-in filters that Access provides (right-click on the column) to further filter or sort a particular column to get just the data they need. But, when Print Preview requeries, it does not use the filters/sort the user has applied, only the QueryDef as it was when I set it based on the main form's comboBoxes. Typically, using the ComboBoxes, they may filter the data they need down to 100 records or so, but then they can filter to some very specific records, say 5-10 using the Access filters on the columns, sorted however they want, but when they choose Print Preview (from a button I have on the Main form), it requeries from the QueryDef, ignores their filters/sorts and shows the full 100 records, sorted in the default order. Going right to Print doesn't do this, but also doesn't give them the options that Print Preview gives them.
Perhaps this is normal behavior, but it is making it very hard to allow the user to customize the report. Right now, most are taking screenshots of the form and using that, but that doesn't give them the other options that Preview gives them (and frankly it's kind of tacky to have to do that). I don't want to have to write VBA code to try to replicate all the options that the built-in Access filters provide.
I have tried to set the Print and Print Preview buttons using a macro, and with VBA, the results are the same. The VBA code I am using for Print Preview is:
Is there some way to stop Print Preview from requerying, or at least to use any filters or sorts the user has used in the form before doing the Print Preview?
My company will be upgrading everyone to Access 2013 and Windows 7 over the next couple of months, if this issue is resolved there, perhaps we can live with it until then, but I don't have a copy of 2013 yet (or Windows 7 on my work PC) to test.
Thanks for all help.
Griffin
I've got an unbound form that has a subform bound to a query. The subform is a continuous form with a dozen or so columns. There are some filter selections (comboBoxes) on the Main form that filters the data in the subform. I do this by changing the QueryDef for the query based on the combobox items the user selects, and requery the subform whenever the user changes one of the comboBoxes. So far, everything works great. When I print the report, it comes out the same as the form.
(More info in case it's relevant: The query is now actually a Stored Procedure on a SQL Server, but the process is still the same.)
I want to use Print Preview instead of Print so that the user can see the report first, adjust margins, scaling, etc. based on the printer where the report is going to print. This also gives them the option to print it to a PDF. All of this is built in to the Access Print Preview ribbon.
So, here's the problem: Unlike the print function, Print preview does a requery on the subform before it pulls up the preview. This is only annoying in most cases, as most users using this project are remote to the server, and the requery means it is slower than the print function. But, in additon to the filters (comboboxes) I have provided, users can use the built-in filters that Access provides (right-click on the column) to further filter or sort a particular column to get just the data they need. But, when Print Preview requeries, it does not use the filters/sort the user has applied, only the QueryDef as it was when I set it based on the main form's comboBoxes. Typically, using the ComboBoxes, they may filter the data they need down to 100 records or so, but then they can filter to some very specific records, say 5-10 using the Access filters on the columns, sorted however they want, but when they choose Print Preview (from a button I have on the Main form), it requeries from the QueryDef, ignores their filters/sorts and shows the full 100 records, sorted in the default order. Going right to Print doesn't do this, but also doesn't give them the options that Print Preview gives them.
Perhaps this is normal behavior, but it is making it very hard to allow the user to customize the report. Right now, most are taking screenshots of the form and using that, but that doesn't give them the other options that Preview gives them (and frankly it's kind of tacky to have to do that). I don't want to have to write VBA code to try to replicate all the options that the built-in Access filters provide.
I have tried to set the Print and Print Preview buttons using a macro, and with VBA, the results are the same. The VBA code I am using for Print Preview is:
Code:
DoCmd.RunCommand acCmdPrintPreview
My company will be upgrading everyone to Access 2013 and Windows 7 over the next couple of months, if this issue is resolved there, perhaps we can live with it until then, but I don't have a copy of 2013 yet (or Windows 7 on my work PC) to test.
Thanks for all help.
Griffin