I have created a search form for users to select criteria for reports. There are 8 different criteria that can be selected - the user can select any combination of criteria and then select a command button which filters the data.
I would like to just create one report and use code to change the report header depending on the criteria selected. For example, if a user selects to view "Paid" items for "Staples" paid between "03/01/2002" and "03/30/2002," the report header will read "Staples Items Paid Between 3/01/2002 and 3/30/2002."
I have code written right now that references the textbox for the header(Text46) as follows:
Dim rpt As Report
DoCmd.OpenReport RptLink, acViewPreview
For Each rpt In Reports
rpt.Controls.Item("Text46".SetFocus
rpt.Controls.Item("Text46".Text = "Mordacia"
Next rpt
This seems to work except that it doesn't recognize "Mordacia" as text - it recognizes it as a parameter and a parameter box appears. How can I get it to recognize "Mordacia" as text? Eventually, I will be setting up a strtitle(string) that recognizes the criteria in the forms and uses it for the header, but first I need to make it recognize the values in the forms as text.
Any suggestions or help would be appreciated.
I would like to just create one report and use code to change the report header depending on the criteria selected. For example, if a user selects to view "Paid" items for "Staples" paid between "03/01/2002" and "03/30/2002," the report header will read "Staples Items Paid Between 3/01/2002 and 3/30/2002."
I have code written right now that references the textbox for the header(Text46) as follows:
Dim rpt As Report
DoCmd.OpenReport RptLink, acViewPreview
For Each rpt In Reports
rpt.Controls.Item("Text46".SetFocus
rpt.Controls.Item("Text46".Text = "Mordacia"
Next rpt
This seems to work except that it doesn't recognize "Mordacia" as text - it recognizes it as a parameter and a parameter box appears. How can I get it to recognize "Mordacia" as text? Eventually, I will be setting up a strtitle(string) that recognizes the criteria in the forms and uses it for the header, but first I need to make it recognize the values in the forms as text.
Any suggestions or help would be appreciated.