关闭所有打开的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源码网店
常见问答:
技术分类:
源码示例
- 【源码QQ群号19834647...(12.17)
- Access对子窗体数据进行批...(10.30)
- 最精简的组合框行来源数据快速输...(10.25)
- Access仿平台的多值选择器...(10.24)
- 【Access日期区间段查询】...(10.22)
- 【Access源码示例】VBA...(10.12)
- Access累乘示例,Acce...(10.09)
- 数值8.88,把整数8去掉,转...(10.08)
- 【Access自定义函数】一个...(09.30)
- 【Access选项卡示例】Ac...(09.09)
学习心得
最新文章
- Access判断多条明细的配方或订...(11.30)
- 如何让后台数据库在局域网共享时,且...(11.29)
- 【Access月初月末日期设置方法...(11.29)
- 【Access IIF函数嵌套示例...(11.26)
- Access快速开发平台--使用组...(11.25)
- Access快速开发平台--对上传...(11.22)
- Access快速开发平台企业版--...(11.18)
- 不会用多表联合查询,多表查询没结果...(11.16)
- 【案例分享】主键字段值含有不间断空...(11.16)
- Access快速开发平台--后台D...(11.14)