MsAccessNL
Member
- Local time
- , 00:53
- Joined
- Aug 27, 2022
- Messages
- 194
I was looking for a (short) function that checkes if a form isloaded as a form and also if it's loaded as a subform. I have found some posts about this subject. The currentproject.allforms...isloaded seems not to work when the form is opened as a subform so you have to check this with another function (probably if a Parent form is present or loop all controls). I came up with a short function that can do both (i think). I only tested it shortly. I am looking for info, if this is a possible working solution.
One note: everybody who wants to reply about my bad English, or is anoyed by my post in any other way, please don't reply, just skip the post. All other people who are willingly to share there knowledge (which is probably much greater then mine) in a positive way, please reply. I use Access 2010
One note: everybody who wants to reply about my bad English, or is anoyed by my post in any other way, please don't reply, just skip the post. All other people who are willingly to share there knowledge (which is probably much greater then mine) in a positive way, please reply. I use Access 2010
Code:
Public Function IsOpen(frm As Form) As Boolean
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' This code is made by Daniel Sanders MsAccess.nl 23-okt-2022
' Call IsOpen(Form_FormTest)
‘ FormTest needs to have an [event procedure]
' True if Form is open (also in design
view) or as Subform
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
If frm.Visible = False Then 'this probably will open F_Public as hidden so you have to close again
DoCmd.Close acForm, frm.Name ' gives no error as F_Public is not open
IsOpen = False
Else
IsOpen = True
End If
End Function
Last edited: