R
RGBrighton
I have an unbound subform for which I wish to make choices on the parent form
which will lead to redefinition of the SQL for the query that is the
rowsource of the subform in the subcontrol of the main form.
The SQL redefinition works fine and the SQL comes out correct but the
subform doesn't refresh. I have read the many helpful posts and answers
about requerying subforms on this forum but still no success. Strangely, (to
me) the subform updates if I click the form into design view and then back
again.
The main form has a button to refresh the data which contains this code:
'set basic SQL clauses
sqlSelect = "SELECT q.* FROM qryBaseStudentList AS q "
sqlOrder = "ORDER BY q.Surname;"
'Set WHERE clause
If Len(ActiveClause & CourseClause) = 0 Then
sqlWhere = " "
Else
sqlWhere = "WHERE " & ActiveClause & CourseClause & " "
End If
sqlString = sqlSelect & sqlWhere & sqlOrder
'Requery
CurrentDb.QueryDefs("qryGeneralStudentList").SQL = sqlString
Forms!frmGeneralStudentList!subcontrolStudentList.Form.Requery
Thanks for reading.
Richard
Access 2003 in XP
which will lead to redefinition of the SQL for the query that is the
rowsource of the subform in the subcontrol of the main form.
The SQL redefinition works fine and the SQL comes out correct but the
subform doesn't refresh. I have read the many helpful posts and answers
about requerying subforms on this forum but still no success. Strangely, (to
me) the subform updates if I click the form into design view and then back
again.
The main form has a button to refresh the data which contains this code:
'set basic SQL clauses
sqlSelect = "SELECT q.* FROM qryBaseStudentList AS q "
sqlOrder = "ORDER BY q.Surname;"
'Set WHERE clause
If Len(ActiveClause & CourseClause) = 0 Then
sqlWhere = " "
Else
sqlWhere = "WHERE " & ActiveClause & CourseClause & " "
End If
sqlString = sqlSelect & sqlWhere & sqlOrder
'Requery
CurrentDb.QueryDefs("qryGeneralStudentList").SQL = sqlString
Forms!frmGeneralStudentList!subcontrolStudentList.Form.Requery
Thanks for reading.
Richard
Access 2003 in XP