代碼很簡單的,我這里的例子是從文本框里輸入新的數據庫路徑,然后更新鏈接。你參考一下,再改。
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
新聞熱點
疑難解答