|
我用下面的代码,导出到EXCEL,可导出的数据没有按时间排列,要怎么做呀???
Private Sub OUTPUT_Click()
On Error GoTo Err_OUTPUT_Click
Dim qdf As DAO.QueryDef
Dim strWhere, strSQL As String
strWhere = Me.VAS_REPORT_Query_subform.Form.Filter
If strWhere = "" Then
strSQL = "SELECT * FROM [VAS REPORT Query]"
Else
strSQL = "SELECT * FROM [VAS REPORT Query] WHERE " & strWhere
End If
Set qdf = CurrentDb.QueryDefs("QueryRESULT")
qdf.SQL = strSQL
qdf.Close
Set qdf = Nothing
DoCmd.OutputTo acOutputQuery, "QueryRESULT", acFormatXLS, , True
Exit_OUTPUT_Click:
Exit Sub
Err_OUTPUT_Click:
MsgBox Err.Description
Resume Exit_OUTPUT_Click
End Sub |
|