Hello everybody,
I have a form based on a query ('qry_1'). There is an option group in the form ('my_opgrp') clicking which causes the query to change (one option is to select all records, the other to select a subset).
Here is the code (simplified) I use for the OnClick event of the option group:
For some reason the form doesn't requery despite the fact the query changes (the sub CreateQuery works, this is not the first time I use it). If I close the form and the reopen it, it displays the right set or records (corresponding to the value of the option group before closing).
Can anyone help me resolve this?
Thank you,
Alex
I have a form based on a query ('qry_1'). There is an option group in the form ('my_opgrp') clicking which causes the query to change (one option is to select all records, the other to select a subset).
Here is the code (simplified) I use for the OnClick event of the option group:
Code:
Private Sub my_opgrp_Click()
Dim sSQL As String
If my_opgrp.Value = 2 Then
sSQL = "SELECT * FROM tbl_1;" 'all records
Else
sSQL = "SELECT * FROM tbl_1 WHERE var1=1;" 'subset
End If
Call CreateQuery(sSQL, "qry_1")
Me.Requery
End Sub
For some reason the form doesn't requery despite the fact the query changes (the sub CreateQuery works, this is not the first time I use it). If I close the form and the reopen it, it displays the right set or records (corresponding to the value of the option group before closing).
Can anyone help me resolve this?
Thank you,
Alex