[AccessD] InputParameters on a report

Joe Rojas JRojas at tnco-inc.com
Thu Jul 24 12:11:09 CDT 2003


You are right Susan,

Here is what I had to do.

On the OnOpen event for the report I tried to set a variable of type Form to
the form that has the DatePickers on it. If this fails, because the form is
not open, I handle the error by opening the form in hidden mode. I wrap it
up by closing the form on the OnClose event of the report.

Seems a tad unnecessary but this problem is written up as a know issue.
I wonder if Access XP has this issue?

Thanks for all the help!

Joe R.

-----Original Message-----
From: Susan Geller [mailto:sgeller at cce.umn.edu]
Sent: Thursday, July 24, 2003 12:10 PM
To: Access Developers discussion and problem solving
Subject: RE: [AccessD] InputParameters on a report

I don't think Darren's method will work because you can't set input
parameters in code for a report in an ADP when the recordsource is a
sproc.  Joe, let me know if I'm wrong.

--Susan


-----Original Message-----
From: Darren DICK [mailto:d.dick at uws.edu.au]
Sent: Wednesday, July 23, 2003 9:14 PM
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] InputParameters on a report


Hi Joe
For such things I test to see if a form is loaded using the IsLoaded
module (see below) If it is - then the RecordSource of the report is
qry_X if not then the RecordSource for the report is qry_Y

Eg in the reports OnOpen or the details OnFormat have something like

    If IsLoaded("frmMyInputForm") then 'My input form is loaded so load
the relevant RecordSource
        Me.RecordSource = "qry_X"
    Else 'My Input form is not loaded so set a different recordsource
        Me.RecordSource = "qry_Y"
    End if

The downside to this method this method requires maintenance of 2
queries or 2 SQL statements Good luck
************************************************************************
****
Function IsLoaded(ByVal strFormName As String) As Boolean
 ' Returns True if the specified form is open in Form view or Datasheet
view.
   
    Const conObjStateClosed = 0
    Const conDesignView = 0
   
    If SysCmd(acSysCmdGetObjectState, acForm, strFormName) <>
conObjStateClosed Then
        If Forms(strFormName).CurrentView <> conDesignView Then
            IsLoaded = True
        End If
    End If
   
End Function
----- Original Message -----
From: "Joe Rojas" <JRojas at tnco-inc.com>
To: "'Access Developers discussion and problem solving'"
<accessd at databaseadvisors.com>
Sent: Wednesday, July 23, 2003 11:56 PM
Subject: [AccessD] InputParameters on a report


> Hi All,
>
> Access 2000 ADP FE & SQL Server 7.0 BE
>
> I have created a stored procedure that I want to use as a record
> source for a report. The stored procedure has two input variables that

> I assigned default values to so that I do not have to assign a value
> when the report opens if I do not need to.
>
> I have a form that has two DatePickers that I use for the two
> variables in the stored procedure.
>
> What I what to happen is if the form is open when the report opens, it

> retrieves the values from the DatePickers and send them to the stored
> procedure via the input parameters of the report. If the form is not
> open, then the input parameters value stays blank and the default
> values in the store procedure are used.
>
> I tried leaving the input parameters value blank and the generating it

> in the On Open event of the report, if needed, but it doesn't seem to
> work. What I mean is that it seems to ignore the input parameters that

> are generated in the On Open event.
>
> Any ideas?
>
> Thanks!
>
> Joe R.
>
>
>
>
> This electronic transmission is strictly confidential to TNCO, Inc.
> and intended solely for the addressee. It may contain information
> which is covered by legal, professional, or other privileges. If you
> are not the intended addressee, or someone authorized by the intended
> addressee to receive transmissions on behalf of the addressee, you
> must not retain, disclose in any form, copy, or take any action in
> reliance on this transmission. If you have received this transmission
> in error, please notify the sender as soon as possible and destroy
> this message. While TNCO, Inc. uses virus protection, the recipient
> should check this email and any attachments for the presence of
> viruses. TNCO, Inc. accepts no liability for any damage caused by any
> virus transmitted by this email.
> _______________________________________________
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
_______________________________________________
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com
_______________________________________________
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com



This electronic transmission is strictly confidential to TNCO, Inc. and
intended solely for the addressee. It may contain information which is
covered by legal, professional, or other privileges. If you are not the
intended addressee, or someone authorized by the intended addressee to
receive transmissions on behalf of the addressee, you must not retain,
disclose in any form, copy, or take any action in reliance on this
transmission. If you have received this transmission in error, please notify
the sender as soon as possible and destroy this message. While TNCO, Inc.
uses virus protection, the recipient should check this email and any
attachments for the presence of viruses. TNCO, Inc. accepts no liability for
any damage caused by any virus transmitted by this email.


More information about the AccessD mailing list