I have a sub-form that has a query as its source. The user enters a value into an unbound text box on the parent form, and the query is run using the user-supplied value to filter the data. I have a button on the parent that launches the macro OnClick, but the sub-form is not updating after the query is run. I have verified that the query is running properly; the hitch is that the subform is not refreshing at all. Here is the code that I'm using:
Private Sub FilterData_Click()
On Error GoTo Err_FilterData
Dim dbs As DAO.Database
Dim rstQ As DAO.Recordset
Set dbs = CurrentDb
Me.[SourceQueryQ].Requery
Forms!EditMntItems001F.[subfrmMaintItemsQ].Form.Refresh
Exit_FilterData:
Set rstQ = Nothing
Set dbs = Nothing
Exit Sub
Err_FilterData:
Resume Exit_FilterData
End Sub
Thanks for your help.
Private Sub FilterData_Click()
On Error GoTo Err_FilterData
Dim dbs As DAO.Database
Dim rstQ As DAO.Recordset
Set dbs = CurrentDb
Me.[SourceQueryQ].Requery
Forms!EditMntItems001F.[subfrmMaintItemsQ].Form.Refresh
Exit_FilterData:
Set rstQ = Nothing
Set dbs = Nothing
Exit Sub
Err_FilterData:
Resume Exit_FilterData
End Sub
Thanks for your help.