自定义链接后端数据库

时间:2009-07-11 01:44:47   来源:第二电脑网  作者:第二电脑网

  第二电脑网导读: 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 ...
  正文:

代码很简单的,我这里的例子是从文本框里输入新的数据库路径,然后更新链接。你参考一下,再改。
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
 



来源:http://www.002pc.com/master/College/Database/Access/2009-07-11/10008.html

收藏到:

关于《自定义链接后端数据库》文章的评论

共有 0 位网友发表了评论 此处只显示部分留言 点击查看完整评论页面

随机文章

    SQL Error: select * from ***_ecms_article where classid='98' and checked=1 order by rand() limit 10

顶出来的热门

    SQL Error: select * from ***_ecms_article where classid='98' and checked=1 order by diggtop desc,id desc limit 10
站内搜索: 高级搜索

热门搜索: Windows style 系统 tr IP QQ CPU 安装 function 注册 if td