ACCESS中自定义链接后端数据库
5405 点击·0 回帖
![]() | ![]() | |
![]() | 代码很简单的,我这里的例子是从文本框里输入新的数据库路径,然后更新链接。你参考一下,再改。 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 | |
![]() | ![]() |