Joe O'Connell
joeo at appoli.com
Tue Apr 17 19:39:41 CDT 2012
Brad, It sounds like you have a popup form that opens a report, so the report "sits behind" the form. If there is only 1 form and 1 report, then when the report opens have it hide the form and then unhide it when the report is closed. However sometimes there can be multiple forms open that could open multiple reports in any sequence, then you need a more generic solution to hide all popup forms when the first report opens and to unhide all forms when the last report closes. Here are 2 subroutines that are easily invoked to hide and unhide all popup forms. Put this in a new module: Option Compare Database Option Explicit Dim i As Integer, intNum As Integer, intNumOpenReport As Integer Dim strPopupForm() As String Const conObjStateClosed = 0 Public Sub HidePopupForms() On Error Resume Next If intNumOpenReport = 0 Then intNum = 0 For i = 0 To Forms.Count - 1 If Forms(i).PopUp = True And Forms(i).Visible = True Then Forms(i).Visible = False intNum = intNum + 1 ReDim Preserve strPopupForm(intNum) strPopupForm(intNum) = Forms(i).name End If Next i End If intNumOpenReport = intNumOpenReport + 1 End Sub Public Sub RestorePopupForms() On Error Resume Next If intNumOpenReport = 1 Then For i = 1 To intNum Forms(strPopupForm(i)).Visible = True Next i ReDim strPopupForm(0) End If intNumOpenReport = intNumOpenReport - 1 End Sub In the open procedure for each report Call HidePopupForms() and in the close procedure for ach report Call RestorePopupForms() Joe O'Connell -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Brad Marks Sent: Tuesday, April 17, 2012 7:59 AM To: Access Developers discussion and problem solving Subject: [AccessD] How to Show a Specific Report at Initiation Time (Whenthere is also a default form) All, We have an Access 2007 application that is used by a number of people. The form that is automatically opened for this ap is a type of report menu. Recently a key player has asked that when the application is opened, he would like to see one report automatically shown on the screen (without needing to push any button or select any tab). Is there a way to have a default form, and yet open a report and give it the focus. I know how to discern the user-id, that it not a problem. The problem is that if I open up the report on the Form Load Event, the report is opened, but only a tab is shown for the report, and the report itself is not visible as it is covered by the default form. I thought that this would be easy to do . I must be missing something. Thanks, Brad