On Error GoTo Err_cmd导出_Click
Dim qdf As DAO.QueryDef
Dim strWhere As String
Dim strSQL As String
strWhere = Me.水电费查询子窗体.Form.Filter
If strWhere = "" Then
'没有条件
strSQL = "SELECT * FROM [水电费查询]"
Else
'有条件
strSQL = "SELECT * FROM [水电费查询] WHERE " & strWhere
End If
Set qdf = CurrentDb.QueryDefs("查询结果")
qdf.SQL = strSQL
qdf.Close