设为首页收藏本站Access中国

Office中国论坛/Access中国论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

返回列表 发新帖
查看: 2529|回复: 9
打印 上一主题 下一主题

[窗体] 自动编号的问题

[复制链接]
1#
发表于 2013-12-2 23:45:44 | 显示全部楼层
Private Function TestConnect() As String     On Error GoTo Err_TestConnect      Dim strConnect As String     Dim Conn As Object    ' New ADODB.Connection      If Nz(Me.txtServer) = "" Or Nz(Me.txtDatabase) = "" Then         MyMsgBox "=86", vbCritical          '未指定数据库。         Exit Function     End If     strConnect = "rovider=SQLOLEDB" & _                  ";Data Source=" & Me.txtServer & _                  ";Initial Catalog=" & Me.txtDatabase & _                  ";User ID=" & Nz(Me.txtUserName) & _                  "assword=" & Nz(Me.txtPassword)          Me.lblTip.Caption = "Connect to the network database," & _                         "due to the need to search the database server in the network," & _                         "the pogram may temporarily lose response,please be patient."     '    Me.lblTip.Caption = "连接网络数据库时,由于需要在网络中搜索数据库服务器," & _          "程序可能会暂时失去响应,请耐心等待。"     Me.Repaint     Set Conn = CreateObject("ADODB.Connection")     Conn.ConnectionString = strConnect     Conn.ConnectionTimeout = 30     Conn.CommandTimeout = 30     Conn.Open     Conn.Close      TestConnect = "ODBC" & _                   ";DRIVER=SQL Server" & _                   ";SERVER=" & Me.txtServer & _                   ";DATABASE=" & Me.txtDatabase & _                   ";UID=" & Me.txtUserName & _                   "WD=" & Me.txtPassword Exit_TestConnect:     Me.lblTip.Caption = ""     Exit Function  Err_TestConnect:     TestConnect = ""     '忽略取消操作错误     If Err <> 3059 Then MsgBox "#" & Err & vbCrLf & Err.Description, vbCritical     Resume Exit_TestConnect End Function把“-”改成“”
您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|站长邮箱|小黑屋|手机版|Office中国/Access中国 ( 粤ICP备10043721号-1 )  

GMT+8, 2024-5-4 12:54 , Processed in 0.082595 second(s), 23 queries .

Powered by Discuz! X3.3

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表