Results 1 to 12 of 12
  1. #1
    5 Star Lounger bfxtrfcmgr's Avatar
    Join Date
    Aug 2002
    Location
    Fresno, California, USA
    Posts
    995
    Thanks
    12
    Thanked 0 Times in 0 Posts

    Re: Min Popup (2002 SP-2)

    Nothing like answering your own question <img src=/S/grin.gif border=0 alt=grin width=15 height=15>
    On second thought, there's no need to keep the form active at all - might just as well close it.
    <pre>Private Sub cmdDFMControl_Click()
    DoCmd.Close acForm, Me.Name, acSaveNo
    Call DFMControlCenter
    End Sub</pre>

    Works just fine. I do, however, have to be careful that other windows are not open either (anyone know how to min/close them all?) Have a good weekend all!
    Bryan,
    Not the smartest critter on the glacier. . .
    . . .but I'm persistent (does that count?)

  2. #2
    5 Star Lounger bfxtrfcmgr's Avatar
    Join Date
    Aug 2002
    Location
    Fresno, California, USA
    Posts
    995
    Thanks
    12
    Thanked 0 Times in 0 Posts

    Min Popup (2002 SP-2)

    I have an unbound form (popup-yes, mod-no) with a cmdbtn to call another application. When the application opens it comes up under my form. As focus is now on the called app, I cannot minimize the form in my app to see the called app. Is there a way to minimize the current form when the cmdbtn is clicked? Current code:
    <pre>Private Sub cmdDFMControl_Click()
    Call DFMControlCenter
    End Sub</pre>

    Bryan,
    Not the smartest critter on the glacier. . .
    . . .but I'm persistent (does that count?)

  3. #3
    Super Moderator
    Join Date
    Jun 2002
    Location
    Mt Macedon, Victoria, Australia
    Posts
    3,993
    Thanks
    1
    Thanked 45 Times in 44 Posts

    Re: Min Popup (2002 SP-2)

    Here is a function that will close all forms and reports that are open in a db, except the Main Menu, and return to the Main Menu.

    You could easily use it to close all forms.

    <pre>Public Function fnMainMenu()
    Dim stFrmName As String
    stFrmName = "frmMainmenu"
    ' Scan the open forms...

    Dim frm As Form
    ' Enumerate Forms collection.
    Do While Forms.Count > 1
    For Each frm In Forms

    If frm.FormName = stFrmName Then
    frm.Visible = True
    Else
    DoCmd.Close acForm, frm.FormName
    End If
    Next frm

    Loop

    Dim rpt As Report
    ' Enumerate Forms collection.
    Do While Reports.Count > 0
    For Each rpt In Reports
    DoCmd.Close acReport, rpt.Name
    Next rpt

    Loop

    End Function

    </pre>

    Regards
    John



  4. #4
    5 Star Lounger bfxtrfcmgr's Avatar
    Join Date
    Aug 2002
    Location
    Fresno, California, USA
    Posts
    995
    Thanks
    12
    Thanked 0 Times in 0 Posts

    Re: Min Popup (2002 SP-2)

    I presume this goes in its own module and then is called from the cmdbtn on my form? (Not much experience with public functions, or code for that matter). I see also that my question wasn't properly presented; the Switchboard would need to remain open and minimized. Will this function also close the switchboard? After I run DFM from frmAccounting (and manually close it after review), I need to return to the switchboard. Thanks for any/all input!
    Bryan,
    Not the smartest critter on the glacier. . .
    . . .but I'm persistent (does that count?)

  5. #5
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Min Popup (2002 SP-2)

    You wrote that you call another application. I take that to mean something outside Access. If that is correct, it won't help to minimize a form within Access, the Access window would still be in front of the called application. It is possible to minimize the Access window, but it is probably more efficient to make the called application appear in the foreground. You call the application by <code>Call DFMControlCenter</code>. What is the code for DFMControlCenter?

  6. #6
    5 Star Lounger bfxtrfcmgr's Avatar
    Join Date
    Aug 2002
    Location
    Fresno, California, USA
    Posts
    995
    Thanks
    12
    Thanked 0 Times in 0 Posts

    Re: Min Popup (2002 SP-2)

    Good morning Hans!

    DFM (Data Flow Manager) is an Access Add-in (by reference); hope I said that right. modDFMLink is as follows:

    <pre>Sub DFMControlCenter()
    Dim i As Integer
    i = Sys_Xface_OpenDriver
    End Sub</pre>

    Bryan,
    Not the smartest critter on the glacier. . .
    . . .but I'm persistent (does that count?)

  7. #7
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Min Popup (2002 SP-2)

    Good afternoon Bryan!

    Does this open a window within the Access application window (the way a form or report "lives" in the Access application window), or does it open a separate application?

  8. #8
    5 Star Lounger bfxtrfcmgr's Avatar
    Join Date
    Aug 2002
    Location
    Fresno, California, USA
    Posts
    995
    Thanks
    12
    Thanked 0 Times in 0 Posts

    Re: Min Popup (2002 SP-2)

    I'm not really sure <img src=/S/grin.gif border=0 alt=grin width=15 height=15>
    please see attachment.
    Bryan,
    Not the smartest critter on the glacier. . .
    . . .but I'm persistent (does that count?)

  9. #9
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Min Popup (2002 SP-2)

    Thanks for the screenshots. So DFM is not a different application, it runs in Access itself. Try code like this:

    Private Sub cmdDFMControl_Click()
    DoCmd.Close acForm, Me.Name, acSaveNo
    Forms![frmSwitchboard].SetFocus
    DoCmd.Minimize
    Call DFMControlCenter
    End Sub

    where frmSwitchboard must be replaced by the name of your switchboard form.

  10. #10
    5 Star Lounger bfxtrfcmgr's Avatar
    Join Date
    Aug 2002
    Location
    Fresno, California, USA
    Posts
    995
    Thanks
    12
    Thanked 0 Times in 0 Posts

    Re: Min Popup (2002 SP-2)

    Hans:

    <img src=/S/clapping.gif border=0 alt=clapping width=19 height=23> . . .Beautiful!
    It works great from the frmAccounting but (typical of my half-thinking) frmSwitchboard can be called from any form in the app. so if frmAccounting is opened on top of any other form (and DFM is called) it closes frmAccounting, minimizes frmSwitchboard, but the "other" form remains on top of DFM. I take that back, frmSwitchboard doesn't even minimize if there are other forms/reports open. Trying to understand the code, I presume it is because Me.Name and frmSwitchboard are the only objects addressed (which of course is all I considered in the question). Is there a way to address any/all open objects when cmdDFMControl is activated? Trying to think ahead this time; it seems that closing all but the frmSwitchboard (minimized) would be the wise thing to do. Sure appreciate the help!
    Bryan,
    Not the smartest critter on the glacier. . .
    . . .but I'm persistent (does that count?)

  11. #11
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Min Popup (2002 SP-2)

    That's what John's code is for. I have taken the liberty to adapt his code and to incorporate it into the On Click procedure. See if this does what you want:

    <code>Private Sub cmdDFMControl_Click()</code>
    <code> Dim strFormName As String</code>
    <code> Dim i As Long</code>

    <code> ' Substitute the name of the switchboard form.</code>
    <code> strFormName = "frmSwitchboard"</code>

    <code> ' Close all forms except switchboard.</code>
    <code> For i = Forms.Count - 1 To 0 Step -1</code>
    <code> If Forms(i).Name <> strFormName Then</code>
    <code> DoCmd.Close acForm, Forms(i).Name, acSaveNo</code>
    <code> End If</code>
    <code> Next i</code>

    <code> ' Close all reports.</code>
    <code> For i = Reports.Count - 1 To 0 Step -1</code>
    <code> DoCmd.Close acReport, Reports(i).Name</code>
    <code> Next i</code>

    <code> ' Minimize switchboard form, if loaded.</code>
    <code> If CurrentProject.AllForms(strFormName).IsLoaded Then</code>
    <code> Forms(strFormName).SetFocus</code>
    <code> DoCmd.Minimize</code>
    <code> End If</code>

    <code> ' Call DFM</code>
    <code> Call DFMControlCenter</code>
    <code>End Sub</code>

  12. #12
    5 Star Lounger bfxtrfcmgr's Avatar
    Join Date
    Aug 2002
    Location
    Fresno, California, USA
    Posts
    995
    Thanks
    12
    Thanked 0 Times in 0 Posts

    Re: Min Popup (2002 SP-2)

    Hans:

    <img src=/S/rofl.gif border=0 alt=rofl width=15 height=15>. . .that's actually what I was attempting to do when you replied. You'd think with all my attempts that VB would begin to understand my language, but no such luck; it is unrelenting. Your solution, on the other hand, is of course correct and eloquent. A perfect solution, thanks so much!!
    Edit: Thanks also (and a tip of the hat) to John for his generous contribution.
    Bryan,
    Not the smartest critter on the glacier. . .
    . . .but I'm persistent (does that count?)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •