D
Dan
I am trying to requery one subreport (datasheet) and the other one ends up requering as well (without a filter-so shows all records, even though it may have already had a filter) (and vice versa). Here is the code I use to requery the first sub form. Essentially the form design contains 2 datasheets with a seperate filter and filter button for each.
Private Sub cmdFilterDept_Click()
Dim stFilter As String
Dim bNotFirst As Boolean
Dim bAtLeastOne As Boolean
frmDeptSubForm.Form.FilterOn = False
If Not IsNull(cboDepartment.Value) Then
stFilter = stFilter + "Dept='" & cboDepartment.Value & "'"
frmDeptSubForm.Form.FilterOn = True
bNotFirst = True
bAtLeastOne = True
End If
If Not IsNull(txtYearDept.Value) Then
If bNotFirst Then stFilter = stFilter + " AND "
stFilter = stFilter + "Year=" & txtYearDept.Value
frmDeptSubForm.Form.FilterOn = True
bAtLeastOne = True
End If
If bAtLeastOne = True Then
frmDeptSubForm.Form.filter = stFilter
End If
frmDeptSubForm.Requery
End Sub
Any ideas ?
Private Sub cmdFilterDept_Click()
Dim stFilter As String
Dim bNotFirst As Boolean
Dim bAtLeastOne As Boolean
frmDeptSubForm.Form.FilterOn = False
If Not IsNull(cboDepartment.Value) Then
stFilter = stFilter + "Dept='" & cboDepartment.Value & "'"
frmDeptSubForm.Form.FilterOn = True
bNotFirst = True
bAtLeastOne = True
End If
If Not IsNull(txtYearDept.Value) Then
If bNotFirst Then stFilter = stFilter + " AND "
stFilter = stFilter + "Year=" & txtYearDept.Value
frmDeptSubForm.Form.FilterOn = True
bAtLeastOne = True
End If
If bAtLeastOne = True Then
frmDeptSubForm.Form.filter = stFilter
End If
frmDeptSubForm.Requery
End Sub
Any ideas ?