AccessProgram
Registered User.
- Local time
- Today, 13:11
- Joined
- Dec 7, 2009
- Messages
- 68
Hi everybody,
I have this code to determine if the table or query object is open and close it if open status:
CODE:
Option Compare Database
Public globalobjstate As Boolean ' booleans are initialized to false
Public Function objstate(Optional objname As Variant, Optional objtype As Variant) As Boolean
objstate = SysCmd(acSysCmdGetObjectState, Application.CurrentObjectType = acTable or acQuery, Application.CurrentObjectName)
End Function
Public Function closemanualopen()
Dim curobjname As String
Dim curobjtype As String
curobjname = Application.CurrentObjectName
curobjtype = Application.CurrentObjectType
If globalobjstate <> objstate Then
DoCmd.Close curobjtype, curobjname
End If
End Function
However, I dont know where to put this event. I would like to know if there is a code that will be triggered on open of a table or query object. Or any equivalent way that will detect if a table or query object is being opened.
I have this code to determine if the table or query object is open and close it if open status:
CODE:
Option Compare Database
Public globalobjstate As Boolean ' booleans are initialized to false
Public Function objstate(Optional objname As Variant, Optional objtype As Variant) As Boolean
objstate = SysCmd(acSysCmdGetObjectState, Application.CurrentObjectType = acTable or acQuery, Application.CurrentObjectName)
End Function
Public Function closemanualopen()
Dim curobjname As String
Dim curobjtype As String
curobjname = Application.CurrentObjectName
curobjtype = Application.CurrentObjectType
If globalobjstate <> objstate Then
DoCmd.Close curobjtype, curobjname
End If
End Function
However, I dont know where to put this event. I would like to know if there is a code that will be triggered on open of a table or query object. Or any equivalent way that will detect if a table or query object is being opened.