关闭所有打开的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.MoveFirst
VarReturn = 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 = 5
ElseIf var = -32764 Then
GetTT = 3
ElseIf var = 5 Then
GetTT = 1
End If
End Function
本人用的,关闭所有的OBJECT
(责任编辑:admin)
- ·关于 Partition 函数在分组查询中的应
- ·Access算术运算符的含义和说明表
- ·mid函数的另类用法
- ·access制作程序运行进度框
- ·Function与Sub的异同(函数调用)
- ·Access判断某个数值是否为某个数据类型
- ·select case后面语句块的值的四种格式
- ·vba条件语句的两种表示方法
- ·Access几种数据类型初始化的值
- ·Access vba null与""空字符串的区别
- ·access vba 数据类型表
- ·Access变量的命名规则
- ·Access中EXIT Sub与End Sub的区别
- ·Access vba中参数前关键字ByRef和ByVal
- ·Access列表框快速全选的技巧【最快】
- ·vba函数的数据类型强制转换