|
在通过ODBC导入表的时候,提示这个这段定义无效,导致无法链接表,应该是access不支持这个时间定义吧
有什么办法解决吗?或者能在导入链接表的时只选择表中的部分字段吗?
Public Sub 创建_Click()
Dim cnn As String
Dim dbs As Object 'Database
Dim tdf As Object 'DAO.TableDef
Dim str_DSN As String, str_DBQ As String, str_UID As String, str_PWD As String, str_odbc As String
Set dbs = CurrentDb
str_DSN = "ods"
str_DBQ = "ods"
str_UID = "cjn"
str_PWD = "cjn.123"
strConnect = "ODBC;DSN=" & str_DSN & ";UID=" & str_UID & ";PWD=" & str_PWD & ";DBQ=" & str_DBQ & ";"
Set tdf = dbs.CreateTableDef("objects") '创建链接表,命名为tblcode_kh_b
tdf.Connect = strConnect
tdf.SourceTableName = "OBJECTS" 'SQL源表
dbs.TableDefs.Append tdf
Set dbs = Nothing
Set tdf = Nothing
Application.RefreshDatabaseWindow '刷新
MsgBox "创建成功,请查看表"
End Sub
|
|