当我的同事突然死亡时,我继承了几个Access数据库。这些包含sql传递我无法运行的查询,因为他们正在寻找与存储密码的odbc连接。如何更改与我的连接以便运行查询?
答案 0 :(得分:0)
在查询“属性”窗口中,应该有一个名为" ODBC Connect Str"的字段。该值将如下所示:
group
只需将UID和PWD值更改为您的值即可。您必须为每个查询执行此操作。
为这样的事情设置服务帐户也是一个好主意,这样当有人离开或无法访问时,您就不会遇到问题。
答案 1 :(得分:0)
Public Sub FixOwner()
Dim oTable As TableDef
For Each oTable In CurrentDb.TableDefs
If oTable.Connect <> "" And InStr(oTable.Connect, "hisUserID") > 0 Then
oTable.Connect = Replace(oTable.Connect, "HisUserID", "YourUserID")
oTable.Connect = Replace(oTable.Connect, "HisPassword", "YourPassword")
End If
Next
Dim oQuery As QueryDef
For Each oQuery In CurrentDb.QueryDefs
If oQuery.Connect <> "" And InStr(oQuery.Connect, "hisUserID") > 0 Then
oQuery.Connect = Replace(oQuery.Connect, "HisUserID", "YourUserID")
oQuery.Connect = Replace(oQuery.Connect, "HisPassword", "YourPassword")
End If
Next
End Sub