I have a subform which displays the results from a saved query.
Now I want to change to another query.
Me.SF_Results.Form.RecordSource = "NewQuery"
It works but the columns which were in the old query and are not in the new query are still displayed and show #Name? in every cell.
How can I update the columns for the new query?
I have found a solution here which involves setting the recordsource to an empty string and then to the new query, but it not working for me.
Also they use “Query.NewQuery” there for some to me unknown reason.
They use
Query.NewQueryfor theSource Objectnot theRecord Sourcebecause they are displaying a query in the subform control, not a form. The subform control is a container that can display tables and queries as well as forms. I would not suggest displaying an editable query, you will lose all control of your data. If you really must do this, make sure that the control is locked.Alternatively, say something about your data and someone may be able to suggest a different solution.