[AccessD] How to Show a Specific ReportatInitiationTime(When there is also a default form)

William Benson vbacreations at gmail.com
Wed Apr 18 09:09:09 CDT 2012


You're saying that in else condition the report is showing behind the form
even though its opened after the form is opened? How odd. Have you tried
docmd.minimize after openform?
On Apr 18, 2012 7:11 AM, "Brad Marks" <BradM at blackforestltd.com> wrote:

> All,
>
> Thanks for the help with this issue.
>
> I have experimented with an Autoexec macro and a function.
>
> This will work nicely "almost".
>
> Building on the example from Joe (below)  ...
>
> I need to open Form1 for the 24 users
>
> I need to open Form1 AND Report1 for the one "Special" user
> AND Report1 needs to be shown on the screen and not sitting behind Form1
> (This is where I am running into issues).  I have experimented with the
> "Visible"
> attribute but have not had success yet.
>
>
> If one-of-the-24 users Then
>    DoCmd.Openform "Form1" ''' this will work nicely
> Else
>  DoCmd.Openform "Form1"
>  DoCmd.OpenReport "Report1" ' & have it be visible on the screen (not
> behind Form1)
> End If
>
>
>
>
>
> Brad
>
> ~~~~~~~~~~~~~~~~~~~~~~~
>
>
> -----Original Message-----
> From: accessd-bounces at databaseadvisors.com on behalf of Joe O'Connell
> Sent: Tue 4/17/2012 10:08 PM
> To: Access Developers discussion and problem solving
> Subject: Re: [AccessD] How to Show a Specific ReportatInitiationTime(When
>       there is also a default form)
>
> Have the autoexec macro run a function.  The function only needs to
> contain an if statement to determine whether the form or the report
> should be opened
>
> Public Function Startup()
> If one-of-the-24 users Then
>    DoCmd.Openform "name of the form"
> Else
>  DoCmd.OpenReport "name of the report"
> End If
> End Function
>
> 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 10:52 PM
> To: Access Developers discussion and problem solving
> Subject: Re: [AccessD] How to Show a Specific Report
> atInitiationTime(When there is also a default form)
>
> I have started to experiment with an Autoexec Macro.
>
> Here's what I would like to do.
>
> Let's say that we have 25 users.
>
> 24 of them need to get a form (selection menu) when the system is
> initiated.
>
> One user (major player) wants to only see one high level graphical
> report without having to choose anything from the menu when the system
> is initiated.
>
> I am quite sure that I can accomplish this with an Autoexec Macro rather
> than trying to "hide" the menu form as I was trying to do in the Report
> Load Event.
>
>
>
>
>
>
>
> -----Original Message-----
> From: accessd-bounces at databaseadvisors.com on behalf of William Benson
> (VBACreations.Com)
> Sent: Tue 4/17/2012 9:19 PM
> To: 'Access Developers discussion and problem solving'
> Subject: Re: [AccessD] How to Show a Specific Report at
> InitiationTime(When     there is also a default form)
>
> Why not use an Autoexec macro to run the report?
>
> If you must run a form for some other reason (can't see why, but if...)
> you could still use a autoexec which calls a function  (RunCode()) which
> opens that form acformhidden). But at the end of the day it is a
> unneeded intermediary step (and you're left with a hidden form open to
> no one's benefit, right?) , so just open the report using the function
> that the autoexec calls via runcode.
> -----Original Message-----
> From: accessd-bounces at databaseadvisors.com
> [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Brad Marks
> Sent: Tuesday, April 17, 2012 9:45 PM
> To: Access Developers discussion and problem solving
> Subject: Re: [AccessD] How to Show a Specific Report at Initiation
> Time(When there is also a default form)
>
> Joe,
>
> Thanks for the help, I appreciate it.
>
> The situation that I am dealing with is quite simple, but a little
> different.
>
> To isolate the problem, I set up a small Access application that has
> only one form and one report.  The form is not a popup form.
>
> The form is designated as the default "Display" form that is
> automatically opened at startup time.
>
> The form opens the report on the form's "On Load" event (This works
> nicely)
>
> I then tried to make the form not visible via the Report's Load Event (I
> tried the Report's Open event also)
>
> For some reason the code "Forms.form1.Visible = False" does not work.
>
> I must be missing something.
>
> Thanks,
>
> Brad
>
>
>
>
>
>
> -----Original Message-----
> From: accessd-bounces at databaseadvisors.com on behalf of Joe O'Connell
> Sent: Tue 4/17/2012 7:39 PM
> To: Access Developers discussion and problem solving
> Subject: Re: [AccessD] How to Show a Specific Report at Initiation
> Time(Whenthere is also a default form)
>
> 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
>
>
>
>
>
> --
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
>
> --
> This message has been scanned for viruses and dangerous content by
> MailScanner, and is believed to be clean.
>
>
> --
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
>
> --
> This message has been scanned for viruses and
> dangerous content by MailScanner, and is
> believed to be clean.
>
>
>
> --
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
>
> --
> This message has been scanned for viruses and
> dangerous content by MailScanner, and is
> believed to be clean.
>
>
> --
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
>
>


More information about the AccessD mailing list