May I know how to write a code to check whether this form is already open?
Printable View
May I know how to write a code to check whether this form is already open?
You may know ;)
Err.Number will be 0 (strname will hold the form name) if the form is open. Otherwise it creates an error.Code:on error resume next
strName=forms("formname").name
This is only one method to do this.
Got what you mean..
I want to include this method in my program that everytime when i click on the openform button, it will check whther the form is already open or not.
if it is open, show a msgbox("already open"), otherwise, just open the form.
using your method.. i will be able to track when the form is already open.
but if it is not open.. it keeps popping out error..which i dont know how to deal with it..
Sub check1()
Dim strname As String
On Error GoTo Err_Open
On Error Resume Next
strname = Forms("temp").Name
MsgBox ("open")
Err_Exit:
Exit Sub
Err_Open:
Resume Err_Exit
End Sub
could you enlighten me on that?