Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access
|
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 12th, 2006, 05:33 PM
Registered User
 
Join Date: Dec 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default form that opens reports and closes form


I need help with a simple Access 2000 form that opens several reports. I would like the menu to always stay in the background and the reports to display maximized in the front of the menu. And as the reports are closed the menu will be visible.

Here is the code I have that opens the reports and closes the menu.

Code:
Private Sub Preview_Click()
On Error GoTo Err_Preview_Click



    If (Forms![Menu]!selectCategory) = "View All Discharged Clients" Then
         DoCmd.OpenReport "RptDischarged", acViewPreview
         DoCmd.Maximize
        DoCmd.RunCommand acCmdFitToWindow
    End If

    If (Forms![Menu]!selectCategory) = "View All Currently Enrolled Clients" Then
         DoCmd.OpenReport "RptEnrolled", acViewPreview
        DoCmd.Maximize
        DoCmd.RunCommand acCmdFitToWindow
    End If

        If (Forms![Menu]!selectCategory) = "View All FA Discharged Clients" Then
         DoCmd.OpenReport "RptFAdischarged", acViewPreview
        DoCmd.Maximize
        DoCmd.RunCommand acCmdFitToWindow
    End If


        If (Forms![Menu]!selectCategory) = "View All Follow Along Clients" Then
         DoCmd.OpenReport "RptFollowAlong", acViewPreview
        DoCmd.Maximize
        DoCmd.RunCommand acCmdFitToWindow
    End If

            If (Forms![Menu]!selectCategory) = "View All Intake Clients" Then
         DoCmd.OpenReport "RptIntake", acViewPreview
        DoCmd.Maximize
        DoCmd.RunCommand acCmdFitToWindow
    End If


        If (Forms![Menu]!selectCategory) = "View All Nonadmitted Clients" Then
         DoCmd.OpenReport "RptNotAdmitted", acViewPreview
        DoCmd.Maximize
        DoCmd.RunCommand acCmdFitToWindow
    End If

    If (Forms![Menu]!selectCategory) = "Search IFSP Dts to Build a Custom Rpt" Then
        DoCmd.OpenQuery "QRYPIVOT", acViewPivotTable, acReadOnly
        DoCmd.Maximize
        DoCmd.RunCommand acCmdFitToWindow
    End If


    If (Forms![Menu]!selectCategory) = "Search Database by Ref Date Range" Then
         DoCmd.OpenReport "RptRefDate", acViewPreview
        DoCmd.Maximize
        DoCmd.RunCommand acCmdFitToWindow
    End If

    If (Forms![Menu]!selectCategory) = "Search Database by Date of Birth Range" Then
         DoCmd.OpenReport "RptDOB", acViewPreview
        DoCmd.Maximize
        DoCmd.RunCommand acCmdFitToWindow
    End If



        If (Forms![Menu]!selectCategory) = "Search by Disposition Date Range" Then
         DoCmd.OpenReport "RptDisposDte", acViewPreview
        DoCmd.Maximize
        DoCmd.RunCommand acCmdFitToWindow
    End If

        If (Forms![Menu]!selectCategory) = "Search by Last Contact Date Range" Then
         DoCmd.OpenReport "RptIntContactDate", acViewPreview
        DoCmd.Maximize
        DoCmd.RunCommand acCmdFitToWindow
    End If

        If (Forms![Menu]!selectCategory) = "All Client Mailing Labels" Then
         DoCmd.OpenReport "All Client Mailing Labels", acViewPreview
        DoCmd.Maximize
        DoCmd.RunCommand acCmdFitToWindow
    End If

        If (Forms![Menu]!selectCategory) = "Active Client Mailing Labels" Then
         DoCmd.OpenReport "Active Client Mailing Labels", acViewPreview
        DoCmd.Maximize
        DoCmd.RunCommand acCmdFitToWindow
    End If


    DoCmd.Close acForm, Me.Name
Exit_Preview_Click:
    Exit Sub

Err_Preview_Click:
    MsgBox Err.Description
    Resume Exit_Preview_Click
End Sub


NewWM
 
Old December 13th, 2006, 09:00 AM
Friend of Wrox
 
Join Date: Mar 2004
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

As a general rule, the reports should have their pop up property set to Yes so they appear in front of the active form - which I am assuming is also maximized.

The report On Open event is where you want the DoCmd.Maximize code, not on the button On Click event.

When they open the report, do not close the form, and it will be there when they close the reports.

HTH

mmcdonal





Similar Threads
Thread Thread Starter Forum Replies Last Post
Want to perform a task after a form opens/displays EdAROC Access VBA 1 June 8th, 2007 08:18 AM
Form Reports ECSScott BOOK: Professional SQL Server 2005 Reporting Services ISBN: 0-7645-8497-9 0 January 10th, 2007 01:31 PM
Form Showing Reports Problem Brendan Bartley Access 2 December 7th, 2006 02:08 PM
FORM action opens in new window nancy HTML Code Clinic 2 April 7th, 2006 08:16 AM
form opens another form tmc Access 3 August 4th, 2004 02:42 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.