I've had this basic code working for quite some time in a program. I just added it to a new form to know when it was visible, but for some reason, the .visible never works. Here is the same code on a little test program that just toggles back and forth between two forms, but never shows .visible. What is wrong?
Private Sub Command1_Click()
Form2.Show
End Sub
Private Sub Form_Load()
Dim frm As Form
Unload Form2
For Each frm In Forms
If frm.Name = "Form1" Then
If frm.Visible Then
Debug.Print "form 1 visible"
End If
Exit For
End If
Next
End Sub
Private Sub Command1_Click()
Form1.Show
End Sub
Private Sub Form_Load()
Unload Form1
For Each frm In Forms
If frm.Name = "Form2" Then
If Form2.Visible Then
Debug.Print "form 2 visible"
End If
Exit For
End If
Next
End Sub
Thanks,
Gary
Private Sub Command1_Click()
Form2.Show
End Sub
Private Sub Form_Load()
Dim frm As Form
Unload Form2
For Each frm In Forms
If frm.Name = "Form1" Then
If frm.Visible Then
Debug.Print "form 1 visible"
End If
Exit For
End If
Next
End Sub
Private Sub Command1_Click()
Form1.Show
End Sub
Private Sub Form_Load()
Unload Form1
For Each frm In Forms
If frm.Name = "Form2" Then
If Form2.Visible Then
Debug.Print "form 2 visible"
End If
Exit For
End If
Next
End Sub
Thanks,
Gary