Private Sub cmd导出_Click()
On Error GoTo Err_cmd导出_Click
Dim qdf As DAO.QueryDef 'qdf被定义为一个查询定义对象
Dim strWhere, 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
Set qdf = Nothing
DoCmd.OutputTo acOutputQuery, "查询结果", acFormatXLS, , True
End Sub
[em00]作者: cg1 时间: 2003-11-8 02:16
请参考