A
Adam Milligan
Hello all-
I have a form with a tab control in it. I have placed a subform on top the
tab control such that it shows up on each page. I am trying to rewrite the
query that the subform is based on in the on change event of the subform and
then requery the subform. My code looks like this:
Private Sub tabCheckAllThatApply_Change()
Select Case Me.tabCheckAllThatApply.Value
Case 0
ChangeBPSQueries 31
Case 1
ChangeBPSQueries 32
Case 2
ChangeBPSQueries 33
Case 3
ChangeBPSQueries 34
Case 4
ChangeBPSQueries 35
Case 5
ChangeBPSQueries 36
End Select
Me.frmBPSCheckAllThatApply_Subform.Form.Requery
End Sub
The "ChangeBPSQueries" sub looks like this:
Public Sub ChangeBPSQueries(sCheckAllThatApplySection As String)
CurrentDb.QueryDefs("qryBPSCheckAllThatApplyRecordsource").SQL = "SELECT *
FROM LibBPSCheckAllThatApply INNER JOIN tblBPSEnrollmentCheckAllThatApply ON
LibBPSCheckAllThatApply.intBPSCheckAllThatApplyID =
tblBPSEnrollmentCheckAllThatApply.intBPSCheckAllThatApply_FK WHERE
intBPSSection = " & sCheckAllThatApplySection
End Sub
The event fires but the subform does not refresh/requery. If I close the
main form and re-open it, the correct data is in the subform, confirming to
me that the query is being re-written properly. I am stumped. Thanks in
advance for any time folks put into this.
Adam Milligan
P.S. The following list of commands also seem to have no effect:
Me.frmBPSCheckAllThatApply_Subform.Form.Refresh
Me.frmBPSCheckAllThatApply_Subform.Requery
Me.Requery
Me.Refresh
I have a form with a tab control in it. I have placed a subform on top the
tab control such that it shows up on each page. I am trying to rewrite the
query that the subform is based on in the on change event of the subform and
then requery the subform. My code looks like this:
Private Sub tabCheckAllThatApply_Change()
Select Case Me.tabCheckAllThatApply.Value
Case 0
ChangeBPSQueries 31
Case 1
ChangeBPSQueries 32
Case 2
ChangeBPSQueries 33
Case 3
ChangeBPSQueries 34
Case 4
ChangeBPSQueries 35
Case 5
ChangeBPSQueries 36
End Select
Me.frmBPSCheckAllThatApply_Subform.Form.Requery
End Sub
The "ChangeBPSQueries" sub looks like this:
Public Sub ChangeBPSQueries(sCheckAllThatApplySection As String)
CurrentDb.QueryDefs("qryBPSCheckAllThatApplyRecordsource").SQL = "SELECT *
FROM LibBPSCheckAllThatApply INNER JOIN tblBPSEnrollmentCheckAllThatApply ON
LibBPSCheckAllThatApply.intBPSCheckAllThatApplyID =
tblBPSEnrollmentCheckAllThatApply.intBPSCheckAllThatApply_FK WHERE
intBPSSection = " & sCheckAllThatApplySection
End Sub
The event fires but the subform does not refresh/requery. If I close the
main form and re-open it, the correct data is in the subform, confirming to
me that the query is being re-written properly. I am stumped. Thanks in
advance for any time folks put into this.
Adam Milligan
P.S. The following list of commands also seem to have no effect:
Me.frmBPSCheckAllThatApply_Subform.Form.Refresh
Me.frmBPSCheckAllThatApply_Subform.Requery
Me.Requery
Me.Refresh