1 Replies - 4908 Views - Last Post: 05 February 2012 - 10:18 AM Rate Topic: -----

#1 raycomp  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 47
  • Joined: 25-August 09

Detect if no forms are open

Posted 03 February 2012 - 12:11 PM

I need code to detect if no forms are open to exit sub and show new form

my current code:

Private Sub mnuSwitchUser_Click()

  Dim X As Form

[i][b]'need code here to detect something like
' If no open forms then
'    frmLogin.show
'    exit sub
' end if[/b][/i]

  'unload all open forms
Beep
    MsgDVZ vbCrLf & "Remember!!! All un-saved data in open forms will be lost " & _
        vbCrLf & vbCrLf & " - Do you want to close all forms?", "Sh16 - Close all forms...", 2, False
            If mdiMainMenu.bNo = True Then
                Exit Sub
                End If
For Each X In Forms
    Unload X
    Set X = Nothing
Next X

frmLogin.Show

End Sub

This post has been edited by raycomp: 03 February 2012 - 12:16 PM


Is This A Good Question/Topic? 0
  • +

Replies To: Detect if no forms are open

#2 BobRodes  Icon User is offline

  • Your Friendly Local Curmudgeon
  • member icon

Reputation: 574
  • View blog
  • Posts: 2,989
  • Joined: 19-May 09

Re: Detect if no forms are open

Posted 05 February 2012 - 10:18 AM

Forms.Count! :)

This post has been edited by BobRodes: 05 February 2012 - 10:18 AM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1