Please help me with some VB Code

  • Thread starter Thread starter MV
  • Start date Start date
M

MV

Hi all,

I have some problems with VB coding.

I want to know if a spesiffic form is allready open. I
know I have to use the IF statement, but I don't know the
correct one.

Can anybody tell me what the correct statement is to see
if a spesiffic form is already open.

Please Help Me.

Regards,

MV
 
MV,

Create a function:

Function IsOpen(formName)
For Each f In Forms
If f.Name = formName Then IsOpen = True
Next
End Function

then put this code into your form:

Dim FormName As String

FormName = InputBox("Which form do you want to check?")
If IsOpen(FormName) Then
MsgBox FormName & " is OPEN"
Else
MsgBox FormName & " is CLOSED"
End If

Michael
 
Back
Top