-
May 30th, 2013, 09:32 PM
#1
Thread Starter
Fanatic Member
How many test form is open?
I suppose there are many programs of the form, I can determine how much the order form is opened and the name of the form is not open? Who can share me with example
-
May 30th, 2013, 09:44 PM
#2
Re: How many test form is open?
If you are asking how to check if specific form is open then loop thru forms collection and check each name:
Code:
Dim frm As Form
For Each frm In Forms
debug.Print frm.Name
Next frm
I let you figure out the rest on your own...
-
Jun 7th, 2013, 01:21 AM
#3
Thread Starter
Fanatic Member
Re: How many test form is open?
1. form that is open can have a number of these?
2. closed form series open with error
For Each frm In Forms
If frm.Name <> Me.Name Then
If frm.MDIChild = True Then
MDIMainForm.RemoveChild frm.Name ' Error here
End If
End If
Next
Set frm = Nothing
-
Aug 11th, 2013, 02:16 AM
#4
Thread Starter
Fanatic Member
Re: How many test form is open?
if I use Unload the following Unload I have must to put the correct name of FormChild. eg MDIForm have Form1, Form2, ... Formn:
Unload Form1
Unload Form2
...
Unload Formn
Now, I want to replace the code above with:
Dim frm As Form
' Close many FormRemoveChild
For Each frm In Forms
If Me.Name <> frm.Name Then ' Me.Name is MDIForm and frm.Name is Form1, Form2, ...., Formn
Unload frm.Name ' Error here
End If
Next
Set frm = Nothing
What should I do ?
-
Aug 11th, 2013, 02:37 AM
#5
Re: How many test form is open?
The Unload statement expects an Object (a Form or a Control), not a String. Try this instead:
Code:
Private Sub mnuCloseAllMDIChildForms_Click()
Do Until Me.ActiveForm Is Nothing
Unload Me.ActiveForm
Loop
End Sub
Last edited by Bonnie West; Aug 15th, 2013 at 04:25 AM.
On Local Error Resume Next: If Not Empty Is Nothing Then Do While Null: ReDim i(True To False) As Currency: Loop: Else Debug.Assert CCur(CLng(CInt(CBool(False Imp True Xor False Eqv True)))): Stop: On Local Error GoTo 0
Declare Sub CrashVB Lib "msvbvm60" (Optional DontPassMe As Any)
-
Aug 15th, 2013, 02:55 AM
#6
Thread Starter
Fanatic Member
Re: How many test form is open?
-
Aug 15th, 2013, 06:48 AM
#7
Re: How many test form is open?
This question was answered already on Code Guru. Did you even try what I showed you?
Basically you do not use the name you use the object as shown here in Red
Code:
For Each frm In Forms
If frm.Name <> Me.Name Then
If frm.MDIChild = True Then
Unload frm
End If
End If
Next
Set frm = Nothing
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|