Actually, I don't know for sure if it is a requery problem....
Here's the situation:
I have a form that allows the user to select a report from a listbox, and manipulate parameters that will be used when generating the report. At the bottom of the form there are command buttons - Print, Preview, and Refresh Default Values. The user can manipulate several parameters and run a report several different times. At some point, they might want to reset all of the parameters back to their default values - that is what the Refresh Default Values command button is for.
My problem is not with the actual code of the requery (the values on the form are reset), but what happens to a particular report after requering the default values.
Here's what happens:
1) Select the report "Performance Management Detail" in the listbox.
2) Only parameters available for the report are shown. All of the parameters have default values.
3) Preview the report (whether using the defaults or customizing it) - WORKS!
4) Close the report (taken back to the reports form) and change some parameters.
5) Preview the report again with the changed parameters - WORKS again!
6) Close the report (back to reports form again) and click on the Refresh Default Values command button. All parameters are reset.
7) Preview the report again with parameters requeried - DOES NOT WORK! (However, if I close the form and re-open, the report will run.)
The error that I get at this point is: "The expression is typed incorrectly, or it is too complex to be evaluated. For example, a numeric expression may contain too many complicated elements. Try simplifying the expression by assigning parts of the expression to variables."
-----
Here is the code that is used to requery parameters (only one parameter is shown - all others are similiar):
Public Sub cmdResetDefaults_Click()
'Requery Start and End Review Dates
Forms!frmReports!frmReportsSUB.Form!txtStartReviewDate = Forms!frmReports!frmReportsSUB.Form!txtStartReviewDate.DefaultValue
Forms!frmReports!frmReportsSUB.Form!txtStartReviewDate.Requery
Forms!frmReports!frmReportsSUB.Form!txtEndReviewDate = Forms!frmReports!frmReportsSUB.Form!txtEndReviewDate.DefaultValue
Forms!frmReports!frmReportsSUB.Form!txtEndReviewDate.Requery
End Sub
----
What I don't understand is why the report will preview, except after requering the default values? Is there some sort of memory bloat that happens when requering? What can I do to fix???
Here's the situation:
I have a form that allows the user to select a report from a listbox, and manipulate parameters that will be used when generating the report. At the bottom of the form there are command buttons - Print, Preview, and Refresh Default Values. The user can manipulate several parameters and run a report several different times. At some point, they might want to reset all of the parameters back to their default values - that is what the Refresh Default Values command button is for.
My problem is not with the actual code of the requery (the values on the form are reset), but what happens to a particular report after requering the default values.
Here's what happens:
1) Select the report "Performance Management Detail" in the listbox.
2) Only parameters available for the report are shown. All of the parameters have default values.
3) Preview the report (whether using the defaults or customizing it) - WORKS!
4) Close the report (taken back to the reports form) and change some parameters.
5) Preview the report again with the changed parameters - WORKS again!
6) Close the report (back to reports form again) and click on the Refresh Default Values command button. All parameters are reset.
7) Preview the report again with parameters requeried - DOES NOT WORK! (However, if I close the form and re-open, the report will run.)
The error that I get at this point is: "The expression is typed incorrectly, or it is too complex to be evaluated. For example, a numeric expression may contain too many complicated elements. Try simplifying the expression by assigning parts of the expression to variables."
-----
Here is the code that is used to requery parameters (only one parameter is shown - all others are similiar):
Public Sub cmdResetDefaults_Click()
'Requery Start and End Review Dates
Forms!frmReports!frmReportsSUB.Form!txtStartReviewDate = Forms!frmReports!frmReportsSUB.Form!txtStartReviewDate.DefaultValue
Forms!frmReports!frmReportsSUB.Form!txtStartReviewDate.Requery
Forms!frmReports!frmReportsSUB.Form!txtEndReviewDate = Forms!frmReports!frmReportsSUB.Form!txtEndReviewDate.DefaultValue
Forms!frmReports!frmReportsSUB.Form!txtEndReviewDate.Requery
End Sub
----
What I don't understand is why the report will preview, except after requering the default values? Is there some sort of memory bloat that happens when requering? What can I do to fix???
Last edited: