[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