Please help me with some VB Code

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
 
M

Michael

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top