|
程序如下:
Private Sub connect_casdata_inf_Click()
Dim valmth
valmth = CLng(Left(txt_valmth, 6))
Call linktoaccess(casdata_path & "\CAS_INF_SUMMARY" & valmth & ".mdb", "CAS_INF" & valmth, "CAS_INF" & valmth)
End Sub
Sub linktoaccess(strdbname As String, strtablename As String, straccesstable)
Dim cat As ADOX.catalog
Dim tbl As ADOX.TableSet cat = New ADOX.catalog
cat.ActiveConnection = CurrentProject.Connection
Set tbl = New ADOX.Table
tbl.Name = straccesstable
Set tbl.ParentCatalog = cat
tbl.Properties("jet oledb:create link") = True
tbl.Properties("jet oledb:link datasource") = strdbname
tbl.Properties("jet oledb:link provider string") = "; pwd=; "
tbl.Properties("jet oledb:remote table name") = strtablename
cat.Tables.Append tbl
End Sub
为什么会运行不通呢? 提示说:运行时错误“-2147467259(80004005)” 没有找到字段“SID” |
|