Access开发培训
网站公告
·Access专家课堂QQ群号:151711184    ·Access快速开发平台下载地址及教程    ·欢迎加入Access专家课堂微信群!    ·如何快速搜索本站文章|示例|资料    
您的位置: 首页 > 技术文章 > 综合其它

关闭所有打开的access对象

时 间:2007-12-24 08:49:09
作 者:Benjamin_luk   ID:8  城市:上海  QQ:2851379730点击这里给张志发消息
摘 要:关闭所有打开的Access对象
正 文:

Public Function CloseObj()
Dim intSt As Integer, intType As Integer, strName As String
Dim rs As DAO.Recordset, J As Long, VarReturn As Variant
'Set rs = Nothing
Set rs = CurrentDb.OpenRecordset("Select MSysObjects.Name, MSysObjects.Type " & _
                                 " FROM MSysObjects Where (((MSysObjects.Name) " & _
                                 " Not Like 'Msys*' And (MSysObjects.Name) Not Like '~*') " & _
                                 " AND ((MSysObjects.Type)<>3 And (MSysObjects.Type)<>-32757 " & _
                                 " And (MSysObjects.Type)<>-32758));")
'Set rs = CurrentDb.OpenRecordset("Select * from DB_Object")
rs.MoveFirstVarReturn = SysCmd(acSysCmdInitMeter, "关闭OBJECT", rs.RecordCount)
Do Until rs.EOF
J = J + 1
intType = GetTT(rs.Fields(1))strName = rs.Fields(0)
DoCmd.Close intType, strName, acSaveYes
'DoCmd.DeleteObject intType, strName
rs.MoveNext
  VarReturn = SysCmd(acSysCmdUpdateMeter, J)
Loop
Set rs = Nothing
End Function
Public Function GetTT(var As Variant) As Integer
If var = -32768 Then
GetTT = 2
ElseIf var = 1 or var = 6 Then
GetTT = 0
ElseIf var = -32766 Then
GetTT = 4
ElseIf var = -32761 Then
GetTT = 5Else
If var = -32764 Then
GetTT = 3
ElseIf var = 5 Then
GetTT = 1
End If
End Function

'本人用的,关闭所有的OBJECT



Access软件网官方交流QQ群 (群号:54525238)       Access源码网店

常见问答:

技术分类:

相关资源:

专栏作家

关于我们 | 服务条款 | 在线投稿 | 友情链接 | 网站统计 | 网站帮助