Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help with building menu

Status
Not open for further replies.

sparkbyte

Technical User
Sep 20, 2002
879
US
I need some insight.

I need a way to check if a form is open, if it is then bring it to the forefront, if not open it.

When opening a new menu the calling menu should be closed and the next menu opened.

I found a function to test if a form is open.

Here is a simplistic script that I have so far.

I am having problems with a menu that is already open but behind another menu/form.

Code:
Private Sub btnTrackingInput_Click()
    If fIsLoaded("Form_TrackingTable") = False Then
        DoCmd.OpenForm ("TrackingTable")
        Else
    '    docmd.SelectObject (acForm ,"TrackingTable",,)
    End If
End Sub


Thanks

John Fuhrman
 
I know, I was asking how to do it.

Code:
Option Compare Database

Private Sub btnOperationsReporting_Click()
    If fIsLoaded("Operations") = False Then
        DoCmd.Close acForm, "Main_Menu", acSaveNo
        DoCmd.OpenForm ("Operations")
        Else
    '    docmd.SelectObject (acForm ,"TrackingTable",,)
    End If

End Sub

Private Sub btnTrackingInput_Click()
    If fIsLoaded("TrackingTable") = False Then
        DoCmd.Close acForm, "Main_Menu", acSaveNo
        DoCmd.OpenForm ("TrackingTable")
        Else
    '    docmd.SelectObject (acForm ,"TrackingTable",,)
    End If
End Sub

Hiding a form is an interesting idea. Would speed up "menus" if they are already loaded. I will have to see how much memory is used if I preload the common menu forms.



Thanks

John Fuhrman
 
This seems to work, but is very simplistic.

Code:
Private Sub btnTrackingInput_Click()
    If fIsLoaded("TrackingTable") = False Then
        Me.Visible = False
        DoCmd.Close acForm, "Main_Menu", acSaveNo
        DoCmd.OpenForm ("TrackingTable")
        Else
        Me.Visible = True
    End If
End Sub

and to return

Code:
Private Sub CloseForm_Click()
       
    If fIsLoaded("Main_Menu") = False Then
        DoCmd.Close
        DoCmd.OpenForm ("Main_Menu")
        Else
        DoCmd.Close
        Forms![Main_Menu].Visible = True
    End If

End Sub


Thanks

John Fuhrman
 
I have noticed that if the form is already open and visible that it is not braught to the fore front. is there a command to bring it foreward?


Thanks

John Fuhrman
 
Overlooking the obvious.

DoCmd.SelectObject acForm, "Menu_CenterOperations"


Thanks

John Fuhrman
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top