[AccessD] InputParameters on a report

Darren DICK d.dick at uws.edu.au
Wed Jul 23 21:14:02 CDT 2003


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


More information about the AccessD mailing list