Hey 
I need some help figuring out why my subform will not update with new data. The subform is based on a query. The query is based on the search criteria a user selects on the main form. So a user selects a name to search on then click the 'Find' button. This runs code that sends a new query def to the query and then the subform should display what results from the updated query. The subform does display whats in the query if I close out the whole form and then reopen it. But if I change the search criteria and click the button, the subform only keeps the same information it had before. However, the query itself IS changeing correctly to reflect the new search criteria. ??
Here is part of the code :
Appreciate any help!!!
I need some help figuring out why my subform will not update with new data. The subform is based on a query. The query is based on the search criteria a user selects on the main form. So a user selects a name to search on then click the 'Find' button. This runs code that sends a new query def to the query and then the subform should display what results from the updated query. The subform does display whats in the query if I close out the whole form and then reopen it. But if I change the search criteria and click the button, the subform only keeps the same information it had before. However, the query itself IS changeing correctly to reflect the new search criteria. ??
Here is part of the code :
Code:
Dim qryDef As QueryDef
Dim qrycriteria As String
qrycriteria = "select * from DocsWithShortLink where " & strDocList
Set qryDef = CurrentDb.QueryDefs("qrytesting")
qryDef.SQL = qrycriteria
'Me.sfSearchResults.Form.Filter = strDocList & "not(" & Notlist & ")"
'Me.sfSearchResults.Form.Filter = strDocList
'Me.sfSearchResults.Form.FilterOn = True
Me.sfSearchResults.Form.Requery
Me.sfSearchResults.Requery
Me.sfSearchResults.Form.Refresh
Me.sfSearchResults.Visible = True
Me.Refresh
Appreciate any help!!!