|
2#
楼主 |
发表于 2014-10-18 22:20:52
|
只看该作者
试用了一下站长的”自动创建ODBC数据源“做个测试,情况是一样的,无法阻止ODBC登录失败后系统给出的登陆框,站长的代码:
Function gt_TestOdbc() As Boolean
On Error GoTo err_c
DoCmd.SetWarnings False
Dim Response As Integer
Dim connstr As String, mydb As DAO.Database
connstr = "ODBC;" & _
"DRIVER=SQL Server;" & _
"SERVER=127.0.0.1,7788;" & _
"DATABASE=wzk;" & _
"UID=sa;" & _
"PWD=admin"
Set mydb = DBEngine.Workspaces(0).OpenDatabase("", False, False, connstr)
gt_TestOdbc = True
Exit Function
err_c:
gt_TestOdbc = False
MsgBox "数据库用户,口令错误,重新登录!", , "文具"
Exit Function
End Function |
|