請教各位先進2個問題
1.當執行此程式會發生"執行階段錯誤'3704':當物件關閉時,不允許操作",請問要如何修正
2.使用Blade(數值)做篩選,可篩選出想要的資料,但改用entrydate(日期)篩選,程式改為~FROM CFData where entrydate>2012/12/1,卻無法篩選出想要的資料
請問是否要另外宣告參數條件
Sub aa()
Dim cnn As New ADODB.Connection
Dim rst As New ADODB.Recordset
cnn.Open "provider=Microsoft.jet.OLEDB.4.0;data source=" & ThisWorkbook.Path & "/Motion.mdb"
Sql = "SELECT entrydate,blade INTO [Excel 8.0;DATABASE=c:\test1.XLS].[main] FROM CFData where blade =1"
[a2].CopyFromRecordset cnn.Execute(Sql) -->會發生執行階段錯誤'3704':當物件關閉時,不允許操作 cnn.Close
cnn.Close
Set cnn = Nothing
End Sub
使用Blade=1可將Blade為1的資料篩選出來