jongoumd2005
MIS
I am trying to create a form in which the user will build an SQL statement by selecting different checkboxes and filling in different criteria. The actual creation of the SQL statement is done on the back end after the user clicks the Submit button. When that happens, my code creates the SQL statement based on the user's selections, and then changes the SQL for one of my Queries. A have a report that uses this query, and in the code, I have the report using the new query, as shown below.
SQL_Statement = CreateSQL()
CurrentDb.QueryDefs("Submit_Query").SQL = SQL_Statement
DoCmd.OpenReport "Results", acViewDesign
Reports![Results].RecordSource = "Submit_Query"
DoCmd.OpenReport "Results", acViewPreview
Currently, my report is blank, because it could show different columns all the time, depending on what the user had selected. Is there any way that I can have the report create 'dynamically' based on what the results of the query are?
My end goal is to have the user select all the criteria, and what information to show, click Submit, and have the report with all the results appear.
If there is a better way to solve this than how I am currently doing so, I am open to suggestions.
Thank you,
Jon
SQL_Statement = CreateSQL()
CurrentDb.QueryDefs("Submit_Query").SQL = SQL_Statement
DoCmd.OpenReport "Results", acViewDesign
Reports![Results].RecordSource = "Submit_Query"
DoCmd.OpenReport "Results", acViewPreview
Currently, my report is blank, because it could show different columns all the time, depending on what the user had selected. Is there any way that I can have the report create 'dynamically' based on what the results of the query are?
My end goal is to have the user select all the criteria, and what information to show, click Submit, and have the report with all the results appear.
If there is a better way to solve this than how I am currently doing so, I am open to suggestions.
Thank you,
Jon