|
Private Sub 下载基础资料_Click()
Dim wrkODBC As Workspace
Dim a As DAO.Connection
Set wrkODBC = CreateWorkspace("NewODBCWorkspace", _
"admin", "", dbUseODBC)
Set a = wrkODBC.OpenConnection("lx", , _
True, "ODBC;DATABASE=fuzhuang;UID=saWD=;")
Dim rstTemp As DAO.Recordset
Set rstTemp = a.OpenRecordset("SELECT * FROM 员工", dbOpenDynaset)
Do Until rstTemp.EOF = True
BB = rstTemp.Fields(0)
DoCmd.RunSQL "INSERT INTO 员工 ( 姓名 ) VALUES '" & BB & "'"
rstTemp.MoveNext
Loop
a.Close
wrkODBC.Close
'为什么总是提示我INSERT INTO 语法错误。第一个员工为SQL SERVER上的表,第二
'个为本地表。
End Sub
|
|