Private Sub Com查询_Click()
On Error GoTo Err_cmd查询_Click
Dim stw As String
stw = ""
If Not IsNull(Me.HY) Then stw = stw & "([HYML_DM] like '" & Me.HY & "') and "
If Not IsNull(Me.ZSXM) Then stw = stw & "([ZSXM_DM] like '" & Me.ZSXM & "') and "
If Len(stw) > 1 Then stw = Left(stw, Len(stw) - 5)
Me.frm查询子窗体.Form.Filter = stw
Me.frm查询子窗体.Form.FilterOn = True
If Me.frm查询子窗体.Form.Recordset.RecordCount > 0 Then
'子窗体的记录数>0
Me.Text10.ControlSource = "=[frm查询子窗体].[Form].[计数]"
Me.Text12.ControlSource = "=[frm查询子窗体].[Form].[合计]"
Else
'子窗体的记录数=0
Me.Text10.ControlSource = "=0"
Me.Text12.ControlSource = "=0.00"
End If
Exit_cmd查询_Click:
Exit Sub
Err_cmd查询_Click:
MsgBox Err.Description
Resume Exit_cmd查询_Click
End Sub