代码很简单的,我这里的例子是从文本框里输入新的数据库路径,然后更新链接。你参考一下,再改。
private sub command0_click()
on error goto err_command0_click
dim cat as adox.catalog
dim tdf as adox.table
me.txtdbnewname.setfocus
set cat = new adox.catalog
set cat.activeconnection = currentproject.connection
set tdf = cat.tables("mytable")
tdf.properties("jet oledb:link datasource") = me.txtdbnewname.text
exit_command0_click:
exit sub
err_command0_click:
msgbox err.description
resume exit_command0_click
end sub
新闻热点
疑难解答