ajetrumpet
09-13-2009, 08:00 PM
This works on any type of object in the database:
The system command built-in function from MS works wonders. here it is:Function GetObjState(strName String, strType As Long) As String
dim ObjState as long
ObjState = SysCmd(acSysCmdGetObjectState, strType, strName)
if ObjState = 0 then
' The object is closed.
GetObjState = "Closed"
elseif ObjState = 1 then
' The object is open.
GetObjState = "Open"
elseif ObjState = 2 then
' The object has been modified
GetObjState = "Modified and UnSaved"
end if
msgbox GetObjState
end function
Here are the object types for the second argument:form = 2
function = 10
macro = 4
module = 5
query = 1
report = 3
table = 0
The system command built-in function from MS works wonders. here it is:Function GetObjState(strName String, strType As Long) As String
dim ObjState as long
ObjState = SysCmd(acSysCmdGetObjectState, strType, strName)
if ObjState = 0 then
' The object is closed.
GetObjState = "Closed"
elseif ObjState = 1 then
' The object is open.
GetObjState = "Open"
elseif ObjState = 2 then
' The object has been modified
GetObjState = "Modified and UnSaved"
end if
msgbox GetObjState
end function
Here are the object types for the second argument:form = 2
function = 10
macro = 4
module = 5
query = 1
report = 3
table = 0