[VBA ] VBA 連到ACCESS方法?

作者: kikkoko (海海人生)   2014-07-21 22:53:11
這應該是DAO連線方法,請問如何改寫成ADO方法
Sub ABC()
Dim DB As Database
Dim RES As Recordset
Dim S As String
Connect$ = "ODBC;DSN=msndb;UID=eefg;PWD=a000user;"
Set DB = OpenDatabase("", False, False, Connect$)
Sheets("Sheet1").Select
S = " SELECT DTN FROM INDICES "
Set RES = DB.OpenRecordset(S, dbOpenSnapshot, dbSQLPassThrough)
Range("B8").CopyFromRecordset RES
End Sub
謝~

Links booklink

Contact Us: admin [ a t ] ucptt.com