I have a form whose date source is a query.
Using QueryDef, in a module (at the moment I am just testing), I delete the old query and replace it with a duplicate that has a WHERE clause.
The OnFocus event has a Me.Refresh statement.
I have also tried Me.Requery.
I have also tried these in the OnFocus event of one of the controls and then tabbed into that control.
The records remain the same as before the module was run.
If I go into design mode and open the query from the datasource property, it reflects the records that match the change.
When I go back to normal mode for the form, the records are correct for the new query.
How can I get the records displayed on the form to match the new query without going through the process of closing and reopening the form?
Using QueryDef, in a module (at the moment I am just testing), I delete the old query and replace it with a duplicate that has a WHERE clause.
The OnFocus event has a Me.Refresh statement.
I have also tried Me.Requery.
I have also tried these in the OnFocus event of one of the controls and then tabbed into that control.
The records remain the same as before the module was run.
If I go into design mode and open the query from the datasource property, it reflects the records that match the change.
When I go back to normal mode for the form, the records are correct for the new query.
How can I get the records displayed on the form to match the new query without going through the process of closing and reopening the form?